lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r909834 - /lucene/java/trunk/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java
Date Sat, 13 Feb 2010 15:03:46 GMT
Author: markrmiller
Date: Sat Feb 13 15:03:45 2010
New Revision: 909834

URL: http://svn.apache.org/viewvc?rev=909834&view=rev
Log:
building a PayloadNearQuery with a PayloadTermQuery that takes its own function thats not
used is kind of odd and confusing - switch to SpanTermQuery

Modified:
    lucene/java/trunk/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java?rev=909834&r1=909833&r2=909834&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java
(original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java
Sat Feb 13 15:03:45 2010
@@ -37,6 +37,7 @@
 import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.search.spans.SpanQuery;
 import org.apache.lucene.search.spans.SpanNearQuery;
+import org.apache.lucene.search.spans.SpanTermQuery;
 import org.apache.lucene.store.RAMDirectory;
 import org.apache.lucene.util.English;
 import org.apache.lucene.util.LuceneTestCase;
@@ -63,13 +64,11 @@
   }
 
   private class PayloadFilter extends TokenFilter {
-    String fieldName;
     int numSeen = 0;
     protected PayloadAttribute payAtt;
 
     public PayloadFilter(TokenStream input, String fieldName) {
       super(input);
-      this.fieldName = fieldName;
       payAtt = addAttribute(PayloadAttribute.class);
     }
 
@@ -93,7 +92,7 @@
     String[] words = phrase.split("[\\s]+");
     SpanQuery clauses[] = new SpanQuery[words.length];
     for (int i=0;i<clauses.length;i++) {
-      clauses[i] = new PayloadTermQuery(new Term(fieldName, words[i]), new AveragePayloadFunction());
 
+      clauses[i] = new SpanTermQuery(new Term(fieldName, words[i]));  
     } 
     return new PayloadNearQuery(clauses, 0, inOrder);
   }



Mime
View raw message