lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kumaran Ramasubramanian <kums....@gmail.com>
Subject Re: Using ​phrase query in Termfilters
Date Wed, 25 Nov 2015 10:24:34 GMT
Hi Uwe

Thanks for the clarification.

​--​
​Kumaran R​


On Wed, Nov 25, 2015 at 2:32 PM, Uwe Schindler <uwe@thetaphi.de> wrote:

> Hi,
>
> To use a real phrase (more than one term) as part of a filter, you have to
> convert the PhraseQuery to a Filter: new QueryWrapperFilter(phrasequery).
> The phrasequery can be built using QueryBuilder that analyzes the string
> and splits it into tokens to create a PhraseQuery: https://goo.gl/HDhn6R
>
> Please note: Filters are deprecated in Lucene 5. In Lucene 5 this is all
> easier! Just use the PhraseQuery as filtering clause in a BooleanQuery
> (using Occur.FILTER).
>
> Uwe
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
>
> > -----Original Message-----
> > From: Kumaran Ramasubramanian [mailto:kums.134@gmail.com]
> > Sent: Wednesday, November 25, 2015 9:13 AM
> > To: java-user@lucene.apache.org
> > Subject: Using ​phrase query in Termfilters
> >
> > Hi All,
> >
> >    Am using lucene 4.10.4. Is it right to add analyzed multi valued
> fields
> > & phrase query for the same field in boolean filter. i believe we could
> not
> > apply analyzers to values in filters. So am not getting results for those
> > filters' match.
> >
> > String phraseTerm = "hello world"
> > > Term term = new Term(key,
> > > ​
> > > phraseTerm);
> > > TermsFilter filter = new TermsFilter(term);
> > > FilterClause filterClause = new FilterClause(filter,
> > > BooleanClause.Occur.SHOULD);
> > > boolFilter.add(filterClause);
> >
> >
> > Please
> > ​guide me with
> >  related articles.
> > ​ Thanks.​
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

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