You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Jamie Johnson <je...@gmail.com> on 2012/02/25 21:16:21 UTC

upgrading Solr - org.apache.lucene.search.Filter and acceptDocs

I'm trying to upgrade an application I have from an old snapshot of
solr to the latest stable trunk and see that the constructor for
Filter has changed, specifically there is another parameter named
acceptDocs, the API says the following

acceptDocs - Bits that represent the allowable docs to match
(typically deleted docs but possibly filtering other documents)

but I'm not sure what specifically this means to my filter.  How
should this be used when trying to upgrade a filter?

Re: upgrading Solr - org.apache.lucene.search.Filter and acceptDocs

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Sat, Feb 25, 2012 at 3:37 PM, Jamie Johnson <je...@gmail.com> wrote:
>  I.e. just do if(!acceptDocs.get(doc)) return false; at
> the top?

Yep, that should do it.

-Yonik
lucenerevolution.com - Lucene/Solr Open Source Search Conference.
Boston May 7-10

Re: upgrading Solr - org.apache.lucene.search.Filter and acceptDocs

Posted by Jamie Johnson <je...@gmail.com>.
I am assuming you meant should not be returned right?  I basically
return a filtered doc id set and do the following


return new FilteredDocIdSet(startingFilter.getDocIdSet(readerCtx, acceptDocs)) {
			@Override
			public boolean match(int doc) {

				//do custom stuff
			}
		};


does the filtereddocidset give me only the ones that match, or is
there something additional I need to do in addition to my custom match
logic here?  I.e. just do if(!acceptDocs.get(doc)) return false; at
the top?

On Sat, Feb 25, 2012 at 3:23 PM, Yonik Seeley
<yo...@lucidimagination.com> wrote:
> On Sat, Feb 25, 2012 at 3:16 PM, Jamie Johnson <je...@gmail.com> wrote:
>> I'm trying to upgrade an application I have from an old snapshot of
>> solr to the latest stable trunk and see that the constructor for
>> Filter has changed, specifically there is another parameter named
>> acceptDocs, the API says the following
>>
>> acceptDocs - Bits that represent the allowable docs to match
>> (typically deleted docs but possibly filtering other documents)
>>
>> but I'm not sure what specifically this means to my filter.  How
>> should this be used when trying to upgrade a filter?
>
> If a document doesn't match acceptDocs, it should be returned by the filter.
> Lucene is basically asking "what documents match your filter AND match
> acceptDocs"
>
> -Yonik
> lucenerevolution.com - Lucene/Solr Open Source Search Conference.
> Boston May 7-10

Re: upgrading Solr - org.apache.lucene.search.Filter and acceptDocs

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Sat, Feb 25, 2012 at 3:16 PM, Jamie Johnson <je...@gmail.com> wrote:
> I'm trying to upgrade an application I have from an old snapshot of
> solr to the latest stable trunk and see that the constructor for
> Filter has changed, specifically there is another parameter named
> acceptDocs, the API says the following
>
> acceptDocs - Bits that represent the allowable docs to match
> (typically deleted docs but possibly filtering other documents)
>
> but I'm not sure what specifically this means to my filter.  How
> should this be used when trying to upgrade a filter?

If a document doesn't match acceptDocs, it should be returned by the filter.
Lucene is basically asking "what documents match your filter AND match
acceptDocs"

-Yonik
lucenerevolution.com - Lucene/Solr Open Source Search Conference.
Boston May 7-10