On Thu, Apr 19, 2012 at 8:32 PM, David Murgatroyd <dmu...@gmail.com> wrote: > In contrast, I think the desire > is that one and only one of the terms in the document match those in the > BooleanQuery so that "Rich" would score higher than "Dick Rich", given > document length normalization. It's almost like a desire for > BooleanQuery bq = new BooleanQuery(false); > bq.set*Maximum*NumberShouldMatch(1); >
you can, by returning a customized weight with a coord impl that PUNISHES documents that match > 1 sub. Take a look at http://svn.apache.org/repos/asf/lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/BoostingQuery.java for some inspiration, especially this part: BooleanQuery result = new BooleanQuery() { @Override public Weight createWeight(IndexSearcher searcher) throws IOException { return new BooleanWeight(searcher, false) { @Override public float coord(int overlap, int max) { // your logic here when overlap == 1, > 1, etc -- lucidimagination.com --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org