You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by Doug Daniels <dd...@rooftophq.com> on 2007/10/24 06:27:03 UTC

Getting a DocSet with a filter and filterList

Hi,

I'm working on a request handler pluging that needs to use a DocSet filter
(for distance limiting) as well as a list of filter queries to filter down a
search.  I'm trying to figure out how to best pass that to the
SolrIndexSearcher.

There's a method that takes a DocSet filter, and method that takes a
List<Query> filterList, but none that take both.  I was thinking I could
convert the filterList to a DocSet and intersect it with the filter, but the
method that does that well getDocSet(List<Query> queries) is protected
access.

Any ideas?

Also, it looks that the getDocListC method, which takes both filter and
filterList, actually uses both if it decides to use the filterCache, but
only uses one of the two if it takes the else block.  Is that by design?

Thanks,
Doug
-- 
View this message in context: http://www.nabble.com/Getting-a-DocSet-with-a-filter-and-filterList-tf4681959.html#a13378896
Sent from the Solr - Dev mailing list archive at Nabble.com.


Re: Getting a DocSet with a filter and filterList

Posted by Henrib <hb...@gmail.com>.
Hi Doug,
I'm having the same kind of issue to filter the list of documents through
their unique id keys and stumbled on the same getDocList hurdle.
The closest to a solution might be using a ConstantScoreQuery that wraps the
filter so everything turns into queries... I could not get another opinion
on that solution though.
Cheers
Henrib


Doug Daniels wrote:
> 
> Hi,
> 
> I'm working on a request handler pluging that needs to use a DocSet filter
> (for distance limiting) as well as a list of filter queries to filter down
> a search.  I'm trying to figure out how to best pass that to the
> SolrIndexSearcher.
> 
> There's a method that takes a DocSet filter, and method that takes a
> List<Query> filterList, but none that take both.  I was thinking I could
> convert the filterList to a DocSet and intersect it with the filter, but
> the method that does that well getDocSet(List<Query> queries) is protected
> access.
> 
> Any ideas?
> 
> Also, it looks that the getDocListC method, which takes both filter and
> filterList, actually uses both if it decides to use the filterCache, but
> only uses one of the two if it takes the else block.  Is that by design?
> 
> Thanks,
> Doug
> 

-- 
View this message in context: http://www.nabble.com/Getting-a-DocSet-with-a-filter-and-filterList-tf4681959.html#a13379079
Sent from the Solr - Dev mailing list archive at Nabble.com.


Re: Getting a DocSet with a filter and filterList

Posted by Doug Daniels <dd...@rooftophq.com>.
I originally built the DocSet using SolrIndexSearcher's convertFilter method.

On Henrib's advice, I switched to wrapping the filter in a
ConstantScoreQuery and passing it in with the other filter queries, which
seems easier to manage.

-Doug


hossman wrote:
> 
> 
> : I'm working on a request handler pluging that needs to use a DocSet
> filter
> : (for distance limiting) as well as a list of filter queries to filter
> down a
> : search.  I'm trying to figure out how to best pass that to the
> : SolrIndexSearcher.
> 
> how did you build up the DocSet?  ... typically a DocSet comes from a 
> Query, and you would just add that query to the other list and let 
> getDocList take care of building the DocSet from it.
> 
> : convert the filterList to a DocSet and intersect it with the filter, but
> the
> : method that does that well getDocSet(List<Query> queries) is protected
> 
> thta looks like it may have been because yonik wasn't certain that he 
> wanted to keep it when he first added it ... but it seems like a generally 
> useful method to me (it would need javadocs before it could be made public 
> however)
> 
> : Also, it looks that the getDocListC method, which takes both filter and
> : filterList, actually uses both if it decides to use the filterCache, but
> : only uses one of the two if it takes the else block.  Is that by design?
> 
> this is why even private should have javadocs .. i believe it is only 
> legal to call this method with *either* a DocSet or a List<Query> .. not 
> both  (Yonik: can you confirm?)
> 
> 
> 
> 
> -Hoss
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Getting-a-DocSet-with-a-filter-and-filterList-tf4681959.html#a13407637
Sent from the Solr - Dev mailing list archive at Nabble.com.


Re: Getting a DocSet with a filter and filterList

Posted by Yonik Seeley <yo...@apache.org>.
On 10/25/07, Chris Hostetter <ho...@fucit.org> wrote:
> : I'm working on a request handler pluging that needs to use a DocSet filter
> : (for distance limiting) as well as a list of filter queries to filter down a
> : search.  I'm trying to figure out how to best pass that to the
> : SolrIndexSearcher.
>
> how did you build up the DocSet?  ... typically a DocSet comes from a
> Query, and you would just add that query to the other list and let
> getDocList take care of building the DocSet from it.

Yeah... keep in mind that one can't get query caching with DocSet
filters, only with the symbolic Query filters.

> : convert the filterList to a DocSet and intersect it with the filter, but the
> : method that does that well getDocSet(List<Query> queries) is protected
>
> thta looks like it may have been because yonik wasn't certain that he
> wanted to keep it when he first added it ...

Yeah, I was sick of adding new variants of public methods only to
discover later that I wished it had more info or that I had done it
differently :-)

So I could see some in the future wanting getDocSet(List<Query>
intersect, List<Query> not, List<DocSet> intersect, List<DocSet> not,
etc...)
But I'm not against promoting the current method to public.


> : Also, it looks that the getDocListC method, which takes both filter and
> : filterList, actually uses both if it decides to use the filterCache, but
> : only uses one of the two if it takes the else block.  Is that by design?
>
> this is why even private should have javadocs .. i believe it is only
> legal to call this method with *either* a DocSet or a List<Query> .. not
> both  (Yonik: can you confirm?)

Correct... I'll make a comment.

-Yonik

Re: Getting a DocSet with a filter and filterList

Posted by Chris Hostetter <ho...@fucit.org>.
: I'm working on a request handler pluging that needs to use a DocSet filter
: (for distance limiting) as well as a list of filter queries to filter down a
: search.  I'm trying to figure out how to best pass that to the
: SolrIndexSearcher.

how did you build up the DocSet?  ... typically a DocSet comes from a 
Query, and you would just add that query to the other list and let 
getDocList take care of building the DocSet from it.

: convert the filterList to a DocSet and intersect it with the filter, but the
: method that does that well getDocSet(List<Query> queries) is protected

thta looks like it may have been because yonik wasn't certain that he 
wanted to keep it when he first added it ... but it seems like a generally 
useful method to me (it would need javadocs before it could be made public 
however)

: Also, it looks that the getDocListC method, which takes both filter and
: filterList, actually uses both if it decides to use the filterCache, but
: only uses one of the two if it takes the else block.  Is that by design?

this is why even private should have javadocs .. i believe it is only 
legal to call this method with *either* a DocSet or a List<Query> .. not 
both  (Yonik: can you confirm?)




-Hoss