This is likely tricky to do correctly.

E.g., MultiFieldQueryParser.getFieldQuery is invoked on whole chunks
of text.  If you search for:

  apple orange

I suspect it won't do what you want, since the whole string "apple
orange" is passed to getFieldQuery.

How do you want to handle e.g. a phrase query (user types "apple
orange", with the double quotes)?  Or a prefix query (app*)?

Maybe you could instead override newTermQuery?  In the example above
it would be invoked twice, once for apple and once for orange.

Finally, all this being said, making everything fuzzy is likely a big
performance hit and often poor results (massive recall, poor
precision) to the user!

Mike McCandless

http://blog.mikemccandless.com


On Mon, Nov 28, 2016 at 6:24 AM, hariram ravichandran
<hariramravichan...@gmail.com> wrote:
> I need to perform *fuzzy search* for the whole search term. I
> extended MultiFieldQueryParser and overridden getFieldQuery()
>
>
> protected Query getFieldQuery(String field, String fieldText,boolean
> quoted) throws ParseException{
>            return *super.getFuzzyQuery(field,fieldText,3.0f);
> //constructing fuzzy query*
> }
>
> For example, If i give search term as "(apple AND orange) OR (mango)", the
> query should be expanded as "(apple~ AND orange~) OR (mango~)".
>
> I need to search in multiple fields and also i need to implement this
> without affecting any of the lucene features. Is there any other simple way?

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to