mirror of https://github.com/apache/lucene.git
added getTermArrays() and extractTerms() to MultiPhraseQuery: LUCENE-514
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@392016 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
901d7ca635
commit
fc0d666c81
|
@ -41,6 +41,10 @@ Bug fixes
|
|||
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
|
||||
|
|
|
@ -17,9 +17,7 @@ package org.apache.lucene.search;
|
|||
*/
|
||||
|
||||
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;
|
||||
|
@ -97,6 +95,14 @@ public class MultiPhraseQuery extends Query {
|
|||
positions.addElement(new Integer(position));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
@ -107,6 +113,17 @@ public class MultiPhraseQuery extends Query {
|
|||
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;
|
||||
private float value;
|
||||
|
|
Loading…
Reference in New Issue