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 Kissue Kissue <ki...@gmail.com> on 2011/12/13 17:03:56 UTC

Matching all documents in the index

Hi,

I have come across this query in the admin interface: *.*
Is this meant to match all documents in my index?

Currently when i run query with q= *.*, numFound is 130310 but the actuall
number of documents in my index is 603308.
Shen i then run the query with q = *  then numFound is 603308 which is the
total number of documents in my index.

So what is the difference between query with q = *.*  and q = * ?

I ran into this problem because i have a particular scenario where in my
index where i have a field called categoryId which i am grouping on and
another field called orgId which i then filter on. So i do grouping on
categoryId but on all documents in the index matching the filter query
field. I use q = *.* but this dosen't give me the true picture as
highlighted above. So i use q = * and this works fine but takes about
2900ms to execute. Is this efficient? Is there a better way to do something
like this?

Solr version = 3.5

Thanks.

Re: Matching all documents in the index

Posted by Chris Hostetter <ho...@fucit.org>.
: Thanks for this. Query time dramatically reduced to 27ms with this.

to understand what is going on, use debugQuery=true with each of those 
examples and look at the query toString info.

*:* is the one and only true syntax (in any solr QParser that i know 
of) for "find all docs" efficiently.

	q=*
or	q=*.*

are (if i'm not mistaken) a prefix query and a wildcard query 
(respectively) against the defualt search field 

("*" is a prefix query matching all terms that start with the empty 
string -- so all terms.  which means it should matchany doc that has 
any term in the default search field -- which in many indexes 
will be all docs, but is a very inefficient and easily falible way to try 
and match all docs)


-Hoss

Re: Matching all documents in the index

Posted by Kissue Kissue <ki...@gmail.com>.
Hi Simon,

Thanks for this. Query time dramatically reduced to 27ms with this.

Many thanks.

On Tue, Dec 13, 2011 at 4:20 PM, Simon Willnauer <
simon.willnauer@googlemail.com> wrote:

> try *:* instead of *.*
>
> simon
>
> On Tue, Dec 13, 2011 at 5:03 PM, Kissue Kissue <ki...@gmail.com>
> wrote:
> > Hi,
> >
> > I have come across this query in the admin interface: *.*
> > Is this meant to match all documents in my index?
> >
> > Currently when i run query with q= *.*, numFound is 130310 but the
> actuall
> > number of documents in my index is 603308.
> > Shen i then run the query with q = *  then numFound is 603308 which is
> the
> > total number of documents in my index.
> >
> > So what is the difference between query with q = *.*  and q = * ?
> >
> > I ran into this problem because i have a particular scenario where in my
> > index where i have a field called categoryId which i am grouping on and
> > another field called orgId which i then filter on. So i do grouping on
> > categoryId but on all documents in the index matching the filter query
> > field. I use q = *.* but this dosen't give me the true picture as
> > highlighted above. So i use q = * and this works fine but takes about
> > 2900ms to execute. Is this efficient? Is there a better way to do
> something
> > like this?
> >
> > Solr version = 3.5
> >
> > Thanks.
>

Re: Matching all documents in the index

Posted by Simon Willnauer <si...@googlemail.com>.
try *:* instead of *.*

simon

On Tue, Dec 13, 2011 at 5:03 PM, Kissue Kissue <ki...@gmail.com> wrote:
> Hi,
>
> I have come across this query in the admin interface: *.*
> Is this meant to match all documents in my index?
>
> Currently when i run query with q= *.*, numFound is 130310 but the actuall
> number of documents in my index is 603308.
> Shen i then run the query with q = *  then numFound is 603308 which is the
> total number of documents in my index.
>
> So what is the difference between query with q = *.*  and q = * ?
>
> I ran into this problem because i have a particular scenario where in my
> index where i have a field called categoryId which i am grouping on and
> another field called orgId which i then filter on. So i do grouping on
> categoryId but on all documents in the index matching the filter query
> field. I use q = *.* but this dosen't give me the true picture as
> highlighted above. So i use q = * and this works fine but takes about
> 2900ms to execute. Is this efficient? Is there a better way to do something
> like this?
>
> Solr version = 3.5
>
> Thanks.