lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Rutherglen <jason.rutherg...@gmail.com>
Subject Re: Implementing customized Scorer with solr API 1.4
Date Thu, 20 Aug 2009 19:10:41 GMT
We should probably move to using Lucene's Filters/DocIdSets
instead of DocSets and merge the two. Then we will not need to
maintain two separate but similar and confusing functionality
classes. This will make seamlessly integrating searching with
Solr's Filters/DocSets into Lucene's new per segment reader
searching easier, especially for new filter writers such as
yourself. Right now we have what appears to be duplicated code.

We probably need several different issues to accomplish what
this requires. One start is SOLR-1308, though I suspect given
the restructuring required, we'll need to break things up into
several separate issues. I'm not really sure what SOLR-1179 was
for.

On Thu, Aug 20, 2009 at 11:17 AM, Jérôme Etévé<jerome.eteve@gmail.com> wrote:
> 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
>
> jerome@eteve.net
>

Mime
View raw message