Hi all,

 I'm kind of struggling with a customized lucene.Scorer of mine, since
I use solr 1.4.

 Here's the problem:

 I wrote a DocSetQuery which inherit from a lucene.Query. This query
is a decorator for a lucene.Query that filters out the documents which
are not in a given set of  predefined documents (a solr.DocSet which I
call docset ).

So In my Weight / Scorer, I implemented the method  nextDoc like that:

public int nextDoc() throws IOException {
do {
         if (decoScorer.nextDoc() == NO_MORE_DOCS) {
              return NO_MORE_DOCS;
         }
        // DO THIS UNTIL the doc is in the docset
 } while (!docset.exists(decoScorer.docID()));
 return decoScorer.docID();
}

The decoScorer here is the decorated scorer.

My problem here is that in docset, there are 'absolute' documents IDs,
but now solr uses a number of sub readers each with a kind of offset,
so decoScorer.docID() gives 'relative' document ID . Because of this,
I happen to test relative document IDs against a set of absolute
docIDs.

So my DocSetQuery does not work anymore. The solution would be I think
to have a way of getting the offset of the SolrReader being used in
the context to be able to do docset.exists(decoScorer.docID() +
offset) .

But how can I get this offset?
The scorer is built with a lucene.IndexReader in parameter:
public Scorer scorer(IndexReader reader) .

Within solr, this IndexReader happens to be an instance of
SolrIndexReader so I though maybe I could downcast reader to a
SolrIndexReader to be able to call the offset related methods on it
(getBase() etc...).

I feel quite unconfortable with this solution since my DocSetQuery
inherits from a lucene thing, so it would be quite odd to downcast
something to a solr class inside it, plus I didn't really figured out
how to use those offset related methods.

Thanks for your help!

All the best!

Jerome Eteve.

-- 
Jerome Eteve.

Chat with me live at http://www.eteve.net

jer...@eteve.net

Reply via email to