Add an "edge" n-gram filter (EdgeNGramFilterFactory) to your "index" analyzer. This will add all the prefixes of words to the index, so that a query of "engi" will be equivalent to but much faster than the wildcard engi*. You can specify a minimum size, such as 3 or 4 to eliminate tons of too-short prefixes, if you want.

See:
http://lucene.apache.org/core/4_0_0/analyzers-common/org/apache/lucene/analysis/ngram/EdgeNGramFilterFactory.html
http://lucene.apache.org/core/4_0_0/analyzers-common/org/apache/lucene/analysis/ngram/EdgeNGramTokenFilter.html

-- Jack Krupansky

-----Original Message----- From: Sohail Aboobaker
Sent: Tuesday, November 06, 2012 8:08 AM
To: solr-user@lucene.apache.org
Subject: Searching for Partial Words

Hi,

Given following values in the document:

Doc1: Engine
Doc2. Engineer
Doc3. ResidentEngineer

We need to return all three documents when someone searches for "engi".

Basically we need to implement partial word search. Currently, we have a
wild card on the right side of search term (term*). Is it possible to have
wild card on both sides of a search term?

Regards,
Sohail Aboobaker.

Reply via email to