Hi all,

 I have a custom search component which uses a query I wrote.
Basically, this Query (called DocSetQuery) is a Query decorator that
skips any document which is not in a given document set. My code used
to work perfectly in solr 1.3 but in solr 1.4, it seems that my
DocSetQuery has lost all its power.

I noticed that to be compliant with solr 1.4 trunk and the lucene it
contains, I should implement two new methods:

createQueryWeight
and
queryWeight

So I did. It was very easy, because basically it's only about re-using
the deprecated Weight createWeight and wrapping the result with a
QueryWeightWrapper.

So now I believe my DocSetQuery complies with the new
solr1.4/lucene2.9-dev api. And I've got those methods:

 public QueryWeight queryWeight(Searcher searcher) throws IOException {
    return createQueryWeight(searcher);
  }
 public QueryWeight createQueryWeight(Searcher searcher) throws IOException {
    log.info("[sponsoring] creating QueryWeight calling createQueryWeight ");
    return new QueryWeightWrapper(createWeight(searcher));
  }
 public Weight weight(Searcher searcher) throws IOException {
    return createWeight(searcher);
  }

//and of course

protected Weight createWeight(final Searcher searcher) throws IOException {
    log.info("[sponsoring] creating weight with DoCset " + docset.size());
    ...
}

I'm then using my DocSetQuery in my custom SearchComponent like that:

Query limitedQuery = new DocSetQuery(decoratedQuery , ... );

Then I simply perform a search by doing

rb.req.getSearcher().search(limitedQuery, myCollector);

My problem is neither of createQueryWeight or createWeight is called
by the solr Searcher, and I'm wondering what I did wrong.
Should I build the Weight myself and call the search method which
accepts a Weight object?

This is quite confusing because:
- it used to work perfectly in solr 1.3
- in the nightly build version of lucene API, those new methods
createQueryWeight and queryWeight have disappeared but with the lucene
solr1.4trunk uses, they exists plus the old ones ( createWeight and
weight) are deprecated.


Thanks for your help.

Jerome Eteve.

-- 
Jerome Eteve.

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

jer...@eteve.net

Reply via email to