lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hariram ravichandran <hariramravichan...@gmail.com>
Subject Re: Query expansion
Date Wed, 30 Nov 2016 12:29:13 GMT
I am overriding getFieldQuery(String field, String fieldText,boolean
quoted). And in case of phrase query,

getFieldQuery(String field, String queryText, int slop) will be called.


And prefix query will not be my use case. So, we can ignore prefix query.


Assume this is my only case. Sequence of words (apple orange mango) as
input, and i need result for (apple~ orange~  mango~).

And I use default conjunction operator as AND (parser.setDefaultOperator(
QueryParser.Operator.AND)) for providing better relevance in results.



That method works as I expected. Is there any drawbacks of using this?


And is there any better method to expand query like this?







On Wed, Nov 30, 2016 at 4:37 AM, Michael McCandless <
lucene@mikemccandless.com> wrote:

> 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
> <hariramravichandar@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?
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message