I have a lucene index I am trying to do a wildcard search.
In index i have a character like
'234Test2343'
I am trying to do the search like %Test%..
My lucene syntax looks like
string catalogNumber="test";
Term searchTerm = new Term("FIELD", "*"+catalogNumber+"*");
Query query = new TermQuery(searchTerm);
I don't get the results back. Any thoughts?
Thanks
You can use a WildCardQuery. A TermQuery looks for the literal asterisk, rather than a wild card. Please note that a WildCardQuery's performance is usually very slow, probably more so when using two wild cards as you do.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With