Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 10-Mar-14 5:33am
v2
Comments
Sergey Alexandrovich Kryukov 10-Mar-14 11:44am    
Why wildcards? Maybe Regular Expressions would be better? At least, they are already implemented...
—SA
sHoE_FeRReT 10-Mar-14 12:12pm    
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.
Sergey Alexandrovich Kryukov 10-Mar-14 14:54pm    
Do you understand that Regular Expression is a big generalization over primitive wildcard approach? Absolutely everything you could do with wildcards, you can do with Regex. If you could not implement something, it simply means that you did it wrong. :-)
—SA

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[^]
 
Share this answer
 
Comments
Maciej Los 10-Mar-14 14:15pm    
The second one link is the best! ;)
+5!
Mehdi Gholam 11-Mar-14 2:33am    
Codeproject articles rock! :)
Sergey Alexandrovich Kryukov 10-Mar-14 14:54pm    
Absolutely, a 5.
—SA
Mehdi Gholam 11-Mar-14 2:33am    
Cheers Sergey!
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 10-Mar-14 14:56pm    
Very good, thank you for complementing my idea, a 5.
Look at the OP's comment to my comment to the question. It looks like she/he wouldn't mind Regex but failed to use it correctly...
—SA
Maciej Los 10-Mar-14 15:01pm    
Thank you, Sergey ;)
I saw OP's comments. What can i say? It happens ;)
Sergey Alexandrovich Kryukov 10-Mar-14 15:06pm    
:-)
...oh, I mean, :-(
—SA
Mehdi Gholam 11-Mar-14 2:34am    
My 5 also!
Maciej Los 11-Mar-14 16:08pm    
Thank you, Mehdi ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900