Methods Summary |
---|
public java.lang.String | getField() return term.field();
|
public org.apache.lucene.search.spans.Spans | getSpans(org.apache.lucene.index.IndexReader reader)
return new Spans() {
private TermPositions positions = reader.termPositions(term);
private int doc = -1;
private int freq;
private int count;
private int position;
public boolean next() throws IOException {
if (count == freq) {
if (!positions.next()) {
doc = Integer.MAX_VALUE;
return false;
}
doc = positions.doc();
freq = positions.freq();
count = 0;
}
position = positions.nextPosition();
count++;
return true;
}
public boolean skipTo(int target) throws IOException {
if (!positions.skipTo(target)) {
doc = Integer.MAX_VALUE;
return false;
}
doc = positions.doc();
freq = positions.freq();
count = 0;
position = positions.nextPosition();
count++;
return true;
}
public int doc() { return doc; }
public int start() { return position; }
public int end() { return position + 1; }
public String toString() {
return "spans(" + SpanTermQuery.this.toString() + ")@"+
(doc==-1?"START":(doc==Integer.MAX_VALUE)?"END":doc+"-"+position);
}
};
|
public org.apache.lucene.index.Term | getTerm()Return the term whose spans are matched. return term;
|
public java.util.Collection | getTerms()
Collection terms = new ArrayList();
terms.add(term);
return terms;
|
public java.lang.String | toString(java.lang.String field)
if (term.field().equals(field))
return term.text();
else
return term.toString();
|