You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Annona Keene <an...@yahoo.com> on 2007/04/04 16:58:11 UTC
Explanation from FunctionQuery
I'm hoping someone can offer some insight into the FunctionQuery. I've just discovered this, and I think it's exactly what I've been looking for, but I'm having some trouble getting it to work. I can create and execute the query, but if I try to see the Explanation, I get an java.lang.UnsupportedOperationException . Can someone show me where I'm going wrong?
Query query = parser.parse(newCriteria);
LinearFloatFunction lff = new LinearFloatFunction(new IntFieldSource("num"), 1.0f, 1.0f);
FunctionQuery fQ = new FunctionQuery(lff);
BooleanQuery bQ = new BooleanQuery();
bQ.add(query, BooleanClause.Occur.MUST);
bQ.add(fQ, BooleanClause.Occur.SHOULD);
I'm using the FunctionQuery with a Query in a BooleanQuery, based on some information I found on this list. However, here's where I run into trouble:
//there's code here that executes the query and does other exciting things
ms.explain(bQ, hit.getId());
The ms is a MultiSearcher. I read that java.lang.UnsupportedOperationException is usually a result of a query not being in it's rewritten form. Is that my problem here? Any help you could offer would be greatly appreciated.
Thanks,
Ann
____________________________________________________________________________________
Looking for earth-friendly autos?
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
http://autos.yahoo.com/green_center/
Re: Explanation from FunctionQuery
Posted by Chris Hostetter <ho...@fucit.org>.
1) which version of FunctionQuery are you using (from the solr repository
or from a Jira issue attachment?)
2) what is hte full stacktrace? (ie: which function/line is throwing the
Exception)
FunctionQuery supports explain just fine, not sure why you'd have
problems, oh wait ... i see exactly what hte problem is...
: The ms is a MultiSearcher. I read that
...this is the implemnetation for MultiSearcher...
public Explanation explain(Weight weight,int doc) {
throw new UnsupportedOperationException();
}
...it's got nothing to do with FunctionQuery.
-Hoss
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org