lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Muir <rcm...@gmail.com>
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 <condit@sdsc.edu> 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
https://issues.apache.org/jira/browse/LUCENE-2892,
it does something similar to what you are doing.

your situation is probably even easier than my example actually:

@Override
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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message