jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Connor, Brett (LNG-TWY)" <Brett.Con...@lexisnexis.co.uk>
Subject RE: Custom ScoreIterator - how do I implement?
Date Mon, 30 Mar 2009 09:53:09 GMT
Perhaps the easiest / safest way might be to wrap the Jackrabbit
iterator in your own at the point of acquisition.

-----Original Message-----
From: Benjamin Brown [mailto:benjamin.brown@thisisnumero.com] 
Sent: 30 March 2009 10:08
To: users@jackrabbit.apache.org
Subject: Custom ScoreIterator - how do I implement?


I have a tree of nodes and each node has a set of scoring criteria, e.g.
most popular, most rated, most recent etc. The criteria are not
implemented as properties against the nodes, i.e. the node guids are
stored on a separate database with stats against them. The reason it is
like this is an architecture decision, since other parts of the system
do not need to know about jcr.

Implementing a class that extends the NodeIterator to use these stats
(scores) is the easy part, however I have no idea how to get jcr to use
this implementation. Looking at the jcr 1.4 source I can see that the
QueryResultImpl uses either of two hardcoded types of NodeIterator in
the private method getNodeIterator(), wherein it creates new instances
at that point. There seems to be no obvious option for the user to
specify the type of iterator and although the class is not final, I
cannot override getNodeIterator() as it is private.

Can someone give me pointers on how to provide a custom node iterator?
Also, can someone please tell me why there are two ScoreNodeIterator
interfaces and the difference between the jcr2spi package and the
core.query.lucene package? I think I should be using the jcr2spi
interface somewhere and not trying to fudge the existing jcr
queryresultimpl into using my implementation however Googling and
looking at the jcr site and wiki have (not yet) yielded results.



LexisNexis is a trading name of REED ELSEVIER (UK) LIMITED - Registered office - 1-3 STRAND,
Registered in England - Company No. 02746621

View raw message