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: u...@thetaphi.de

> -----Original Message-----
> From: Kumaran Ramasubramanian [mailto:kums....@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-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to