Methods Summary |
---|
public void | addSpanNearQuery(org.apache.lucene.search.Query q)
if (q == SrndQuery.theEmptyLcnQuery)
return;
if (! (q instanceof SpanNearQuery))
throw new AssertionError("Expected SpanNearQuery: " + q.toString(getFieldName()));
/* CHECKME: wrap in Hashable...? */
addSpanQueryWeighted((SpanNearQuery)q, q.getBoost());
|
protected void | addSpanQueryWeighted(org.apache.lucene.search.spans.SpanQuery sq, float weight)
Float w = (Float) weightBySpanQuery.get(sq);
if (w != null)
w = new Float(w.floatValue() + weight);
else
w = new Float(weight);
weightBySpanQuery.put(sq, w);
|
public void | addTermWeighted(org.apache.lucene.index.Term t, float weight)
SpanTermQuery stq = qf.newSpanTermQuery(t);
/* CHECKME: wrap in Hashable...? */
addSpanQueryWeighted(stq, weight);
|
public void | clear()weightBySpanQuery.clear();
|
public BasicQueryFactory | getBasicQueryFactory()return qf;
|
public java.lang.String | getFieldName()return fieldName;
|
public org.apache.lucene.index.IndexReader | getIndexReader()return reader;
|
public org.apache.lucene.index.TermEnum | getTermEnum(java.lang.String termText)
return getIndexReader().terms(new Term(getFieldName(), termText));
|
public org.apache.lucene.search.spans.SpanQuery | makeSpanNearClause()
SpanQuery [] spanQueries = new SpanQuery[size()];
Iterator sqi = weightBySpanQuery.keySet().iterator();
int i = 0;
while (sqi.hasNext()) {
SpanQuery sq = (SpanQuery) sqi.next();
sq.setBoost(((Float)weightBySpanQuery.get(sq)).floatValue());
spanQueries[i++] = sq;
}
if (spanQueries.length == 1)
return spanQueries[0];
else
return new SpanOrQuery(spanQueries);
|
public int | size()return weightBySpanQuery.size();
|