Hi,

I have implemented a QueryParser that queries another solr core and returns a 
list of values (resourceIds) that are the primary solr key on the main core. I 
then query the main core using the resourceId to retrieve the Lucene docId. I 
build up an array of ints of these doc ids. I put this array into a Filter.

In getDocIdSet on the filter, I do (where userDocIds is the set of docIds from 
the query above) returns :
@Override
    public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
        log.info("Filter docIdSet is being retrieved: " + userDocIds.length);   
 //temporary
        for(int i=0; i < userDocIds.length; i++) //temporary
            log.info(i + "Id in the docSet " + userDocIds[i]); //temporary
        return new SortedVIntList(userDocIds);
    }

In the filter I have:
@Override
    public Query parse() throws ParseException {
        return new FilteredQuery(preConstructedQuery, favoritesFilter);
    }

I have verified the first steps, the query to the other core returns the 
correct set of documents, the query on the primary key in the mainCore is 
returning the correct Lucene docId (verified via Luke), the filter contains the 
correct set of doc ids and the getDocIdSet is called and getDocIdSet returns 
the correct set of docIds to allow in the response.

What is happening is when querying with something like this: {!favorites 
userid=1023882726 folder=folder2}*:* the filter returns the correct set and 
then a multiple of 3 times the number of random results. As in: expect 1, get 
3; expect 2, get 6; expect 3, get 9; and so on. For example, the results where 
I expect only resourceId: 978061808799015 ,docId:4 and 4 is the only entry in 
the docIdSet, I get a document with resourceId: 978061808799015 (docId:4) then 
one with resourceId: 978061808798315  (docId:111) and lastly 9780618088881101 
(docId:187) In the logs I see that getDocIdSet is called 3 times for every 
query with the correct docIdSet & contents returned every time.

If I do a query with {!favorites userid=1023882726 folder=folder2}grade:2 and 
no documents exist for that user in that folder that match a mainCore document 
with grade:2, then I get a random result back. I would expect no results.

This  {!favorites userid=1023882726 folder=folder2}grade:3 returns the exactly 
what I am looking for, I guess because there is a document that matches grade:3 
that was returned from the other core.

I have some tests that use the AbstractSolrTestCase, in there I do not see the 
getDocIdSet getting called 3 times.

Thanks for your help,
Steve

Reply via email to