You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2015/02/21 16:19:19 UTC
svn commit: r1661379 - in /lucene/dev/branches/branch_5x: ./ lucene/
lucene/core/
lucene/core/src/java/org/apache/lucene/search/SloppyPhraseScorer.java
Author: rmuir
Date: Sat Feb 21 15:19:18 2015
New Revision: 1661379
URL: http://svn.apache.org/r1661379
Log:
LUCENE-6274: SloppyPhrase approximations
Modified:
lucene/dev/branches/branch_5x/ (props changed)
lucene/dev/branches/branch_5x/lucene/ (props changed)
lucene/dev/branches/branch_5x/lucene/core/ (props changed)
lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/search/SloppyPhraseScorer.java
Modified: lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/search/SloppyPhraseScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/search/SloppyPhraseScorer.java?rev=1661379&r1=1661378&r2=1661379&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/search/SloppyPhraseScorer.java (original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/search/SloppyPhraseScorer.java Sat Feb 21 15:19:18 2015
@@ -627,4 +627,49 @@ final class SloppyPhraseScorer extends S
@Override
public String toString() { return "scorer(" + weight + ")"; }
+
+ @Override
+ public TwoPhaseDocIdSetIterator asTwoPhaseIterator() {
+ return new TwoPhaseDocIdSetIterator() {
+ @Override
+ public DocIdSetIterator approximation() {
+ return new DocIdSetIterator() {
+ @Override
+ public int docID() {
+ return SloppyPhraseScorer.this.docID();
+ }
+
+ @Override
+ public int nextDoc() throws IOException {
+ return advance(max.doc + 1);
+ }
+
+ @Override
+ public int advance(int target) throws IOException {
+ assert target > docID();
+ if (!advanceMin(target)) {
+ return NO_MORE_DOCS;
+ }
+ while (min.doc < max.doc) {
+ if (!advanceMin(max.doc)) {
+ return NO_MORE_DOCS;
+ }
+ }
+ return max.doc;
+ }
+
+ @Override
+ public long cost() {
+ return SloppyPhraseScorer.this.cost();
+ }
+ };
+ }
+
+ @Override
+ public boolean matches() throws IOException {
+ sloppyFreq = phraseFreq(); // check for phrase
+ return sloppyFreq != 0F;
+ }
+ };
+ }
}