lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Muir <>
Subject Re: Best practice for stemming and exact matching
Date Tue, 29 Mar 2011 23:21:13 GMT
On Tue, Mar 29, 2011 at 6:56 PM, Christopher Condit <> wrote:

> Ideally I'd like to have the parser use the
> custom analyzer for everything unless it's going to parse a clause into
> a PhraseQuery or a MultiPhraseQuery, in which case it uses the
> SimpleAnalyzer and looks in the _exact field - but I can't figure out
> the best way to accomplish this.

You might be interested in the example i added to the QP tests in,
it does something similar to what you are doing.

your situation is probably even easier than my example actually:

protected Query getFieldQuery(String field, String queryText, boolean
quoted) throws ParseException {
  if (quoted) {
    field = field + "_exact"; // lie about the field to superclass if
the user quoted it.
  return super.getFieldQuery(field, queryText, quoted);

if you are using perfieldanalyzerwrapper so that these "_exact" fields
don't use stemming, then it should just work.
you'll need branch_3.x or trunk for this, but looks like 3.1 is close

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message