mirror of https://github.com/apache/lucene.git
revert position increment change due to conflict with PhraseQuery
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150152 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7298a4a49e
commit
d83ae1586c
|
@ -7,12 +7,6 @@ $Id$
|
||||||
1. Added catch of BooleanQuery$TooManyClauses in QueryParser to
|
1. Added catch of BooleanQuery$TooManyClauses in QueryParser to
|
||||||
throw ParseException instead. (Erik Hatcher)
|
throw ParseException instead. (Erik Hatcher)
|
||||||
|
|
||||||
2. Modified StopFilter to increment positions to account for
|
|
||||||
stop words removed. This prevents exact phrase queries from
|
|
||||||
matching erroneously (use slop factor to account for missing
|
|
||||||
stop words). StopFilter is used by StopAnalyzer, StandardAnalyzer
|
|
||||||
and some others. (Erik Hatcher)
|
|
||||||
|
|
||||||
1.3 RC3
|
1.3 RC3
|
||||||
|
|
||||||
1. Added minMergeDocs in IndexWriter. This can be raised to speed
|
1. Added minMergeDocs in IndexWriter. This can be raised to speed
|
||||||
|
|
|
@ -57,12 +57,8 @@ package org.apache.lucene.analysis;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
|
|
||||||
/**
|
/** Removes stop words from a token stream. */
|
||||||
* Removes stop words from a token stream. Position increments
|
|
||||||
* on tokens emitted are adjusted to account for words
|
|
||||||
* removed. Exact phrase queries will not match across holes left
|
|
||||||
* by stop word removal, but sloppy phrase queries may match.
|
|
||||||
*/
|
|
||||||
public final class StopFilter extends TokenFilter {
|
public final class StopFilter extends TokenFilter {
|
||||||
|
|
||||||
private Hashtable table;
|
private Hashtable table;
|
||||||
|
@ -93,17 +89,10 @@ public final class StopFilter extends TokenFilter {
|
||||||
|
|
||||||
/** Returns the next input Token whose termText() is not a stop word. */
|
/** Returns the next input Token whose termText() is not a stop word. */
|
||||||
public final Token next() throws IOException {
|
public final Token next() throws IOException {
|
||||||
int position = 1;
|
|
||||||
|
|
||||||
// return the first non-stop word found
|
// return the first non-stop word found
|
||||||
for (Token token = input.next(); token != null; token = input.next()) {
|
for (Token token = input.next(); token != null; token = input.next())
|
||||||
if (table.get(token.termText) == null) {
|
if (table.get(token.termText) == null)
|
||||||
token.setPositionIncrement(position);
|
|
||||||
return token;
|
return token;
|
||||||
}
|
|
||||||
|
|
||||||
position++;
|
|
||||||
}
|
|
||||||
// reached EOS -- return null
|
// reached EOS -- return null
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue