相关文章推荐
坚强的吐司  ·  TensorRT ...·  1 年前    · 
Hello,
I'm currently looking to provide a way for users to search a large list of strings (at least 400,000) using wildcards and possibly provide auto completion (this is not essential).
Something like
*test
Would return all the strings that end in "test" for example.
I've investigated looking into different types of searches including a trie setup, but I can't tell if these provide wildcard functionality or if they need an actual prefix to work with?
A few source code examples I've downloaded seem to require a prefix.
Any advice would be greatly appreciated.
Thanks
We need wildcards to search for strings that end with particular patterns. I tried a LINQ with a regular expression to create the wildcard functionality, this worked fine unless the first character was a wildcard. something like "t*est" would return results quickly, but "*test" could take upto around 10 seconds.
You need to create inverted indexes or use a component like lucene : https://lucenenet.apache.org/ [ ^ ]
or my article hOOt : hOOt - full text search engine [ ^ ] Please, read Sergey's comment to the question and follow below links:
How to: Search Strings Using String Methods (C# Programming Guide) [ ^ ]
How to: Search Strings Using Regular Expressions (C# Programming Guide) [ ^ ]
  • Read the question carefully.
  • Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  • If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  • Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question. Let's work to help developers, not make them feel stupid.
  •