lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r392016 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/search/MultiPhraseQuery.java
Date Thu, 06 Apr 2006 17:12:46 GMT
Author: yonik
Date: Thu Apr  6 10:12:44 2006
New Revision: 392016

URL: http://svn.apache.org/viewcvs?rev=392016&view=rev
Log:
added getTermArrays() and extractTerms() to MultiPhraseQuery: LUCENE-514

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/src/java/org/apache/lucene/search/MultiPhraseQuery.java

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/CHANGES.txt?rev=392016&r1=392015&r2=392016&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Thu Apr  6 10:12:44 2006
@@ -41,6 +41,10 @@
  8. LUCENE-541: Add missing extractTerms() to DisjunctionMaxQuery
     (Stefan Will via Yonik Seeley)
 
+ 9. LUCENE-514: Added getTermArrays() and extractTerms() to
+    MultiPhraseQuery (Eric Jain & Yonik Seeley)
+
+
 1.9.1
 
 Bug fixes

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/MultiPhraseQuery.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/search/MultiPhraseQuery.java?rev=392016&r1=392015&r2=392016&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/MultiPhraseQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/MultiPhraseQuery.java Thu Apr  6 10:12:44
2006
@@ -17,9 +17,7 @@
  */
 
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Vector;
+import java.util.*;
 
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.MultipleTermPositions;
@@ -98,6 +96,14 @@
   }
 
   /**
+   * Returns a List<Term[]> of the terms in the multiphrase.
+   * Do not modify the List or it's contents.
+   */
+  public List getTermArrays() {
+	  return Collections.unmodifiableList(termArrays);
+  }
+
+  /**
    * Returns the relative positions of terms in this phrase.
    */
   public int[] getPositions() {
@@ -106,6 +112,17 @@
       result[i] = ((Integer) positions.elementAt(i)).intValue();
     return result;
   }
+
+  // inherit javadoc
+  public void extractTerms(Set terms) {
+    for (Iterator iter = termArrays.iterator(); iter.hasNext();) {
+      Term[] arr = (Term[])iter.next();
+      for (int i=0; i<arr.length; i++) {
+        terms.add(arr[i]);
+      }
+    }
+  }
+
 
   private class MultiPhraseWeight implements Weight {
     private Similarity similarity;



Mime
View raw message