search with part of string
Hi,
I am facing some strange problem in lucene search.
My lucene document has three field
1. name
2. description
3. themeid
i am creating my indexes with these three fields.
I have these scenario in search.
I have text field where user can enter keyword to be searched.
Now one document has name Stallion.
If user enter Stallion in search field it gives search result to him.
But one user enters sta in search field it does not give any result.
I need to show all the document which has sta in their name in this case.
I am creating index for name field
cardDocument
.add(new Field(CardSearchField.name.toString(), card
.getName(), Field.Store.YES,
Field.Index.ANALYZED));
I dont know why lucene is not giving any result for partial string.
Please tell me what i have to do to enable this search algorithm.
Regards
Virendra
search with part of string
In Lucene, you need to turn on wildcard capability, it's not enabled by default however in Solr, it is enabled by default. You can check out more here:
Wildcard Searches - Search by Lucid Imagination
Cheers
Ervin