jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Reutegger <marcel.reuteg...@gmx.net>
Subject Re: Getting the score value from the Query NodeIterator results
Date Wed, 24 May 2006 05:12:53 GMT
there is a way, but it is not something that will be officially supported. 
There is an internal interface that exposes a getScore() method: 
o.a.j.core.query.lucene.ScoreNodeIterator.
NodeIterator instances that are returned by jackrabbits QueryResult 
*currently* implement this interface.

so, you can do the following:

QueryResult results = ...
ScoreNodeIterator nodes = (ScoreNodeIterator) results.getNodes();
while (nodes.hasNext()) {
     float score = nodes.getScore();
     Node n = nodes.nextNode();
}

regards
  marcel

David Kennedy wrote:
> Is it possible to get the score from the Query using the NodeIterator? 
> It's very unfortunate and inefficient to have to convert from Row to Node 
> and vice versa when we want the score in addition to the node structure.
> 
> David


Mime
View raw message