searcher.numDocs OR

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

searcher.numDocs OR

maustin
How can I get a count like I do by using searcher.numDocs(query, docset) but
with it doing an OR operation? I want the number of documents that match a
OR b?

Thanks,
Mike
Reply | Threaded
Open this post in threaded view
|

Re: searcher.numDocs OR

Yonik Seeley-2
On 10/23/06, Mike Austin <[hidden email]> wrote:
> How can I get a count like I do by using searcher.numDocs(query, docset) but
> with it doing an OR operation? I want the number of documents that match a
> OR b?

It's not clear to me what you are trying to calculate.
In code, If you just want the size of the union of two sets, use
DocSet.unionSize().
If you want the number of documents in a query that match a or b, then use

numDocs(query, getDocSet("a OR b"))
  OR
numDocs(query, getDocSet("a").union(getDocSet("b")))

From the request handlers, the only thing you could do would be to
combine a OR b in a single facet query:

q=foo&facet.query=a OR b

It wouldn't result in optimal caching if a and b have many valid
combinations, but that could possibly be handled by a future
optimization in Solr that could decompose boolean queries int
getDocSet().

-Yonik
Reply | Threaded
Open this post in threaded view
|

Re: searcher.numDocs OR

maustin
I want to know... If I have a maindocset with many filters already, how many
more documents would I get if I added one more OR query to the maindocset.

I've been using numDocs to get the count if I wanted to narrow my maindocset
down because numDocs says that it must be in the maindocset AND in the new
query. But, I want to know how many docs would I have if I added a new OR
query? Instead of testing how much I would narrow the facets.. I want to
know how many documents would be added by a certain OR query.

I'm now looking into unionSize, intersectSize, and andNotSize...
Thanks..

On 10/23/06, Yonik Seeley <[hidden email]> wrote:

>
> On 10/23/06, Mike Austin <[hidden email]> wrote:
> > How can I get a count like I do by using searcher.numDocs(query, docset)
> but
> > with it doing an OR operation? I want the number of documents that match
> a
> > OR b?
>
> It's not clear to me what you are trying to calculate.
> In code, If you just want the size of the union of two sets, use
> DocSet.unionSize().
> If you want the number of documents in a query that match a or b, then use
>
> numDocs(query, getDocSet("a OR b"))
> OR
> numDocs(query, getDocSet("a").union(getDocSet("b")))
>
> From the request handlers, the only thing you could do would be to
> combine a OR b in a single facet query:
>
> q=foo&facet.query=a OR b
>
> It wouldn't result in optimal caching if a and b have many valid
> combinations, but that could possibly be handled by a future
> optimization in Solr that could decompose boolean queries int
> getDocSet().
>
> -Yonik
>