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 Dennis Gearon <ge...@sbcglobal.net> on 2010/10/19 06:51:21 UTC

count(*) equivilent in Solr/Lucene

Is there something in Solr/Lucene that could give me the equivalent to:

SELECT 
  COUNT(*) 
WHERE
  date_column1 > :start_date AND
  date_column2 > :end_date;

Providing I take into account deleted documents, of course (I.E., do some sort of averaging or some tracking function over time.)


Dennis Gearon

Signature Warning
----------------
It is always a good idea to learn from your own mistakes. It is usually a better idea to learn from others’ mistakes, so you do not have to make them yourself. from 'http://blogs.techrepublic.com.com/security/?p=4501&tag=nl.e036'

EARTH has a Right To Life,
  otherwise we all die.

Re: count(*) equivilent in Solr/Lucene

Posted by Grant Ingersoll <gs...@apache.org>.
On Oct 19, 2010, at 2:09 AM, Dennis Gearon wrote:

> I/my team will have to look at that and decode it,LOL! I get some of it.
> 
> The database version returns 1 row, with the answer.
> 
> What does this return and how fast is it on BIG indexes?

rows=0 returns 0 rows, but the total count will be returned.  You can do rows=0 with any query to get the total number of matches.

> 
> PS, that should have been:
> .
> .
> .
>   date_column2 < :end_date;
> .
> 
> Dennis Gearon
> 
> Signature Warning
> ----------------
> It is always a good idea to learn from your own mistakes. It is usually a better idea to learn from others’ mistakes, so you do not have to make them yourself. from 'http://blogs.techrepublic.com.com/security/?p=4501&tag=nl.e036'
> 
> EARTH has a Right To Life,
>  otherwise we all die.
> 
> 
> --- On Mon, 10/18/10, Chris Hostetter <ho...@fucit.org> wrote:
> 
>> From: Chris Hostetter <ho...@fucit.org>
>> Subject: Re: count(*) equivilent in Solr/Lucene
>> To: solr-user@lucene.apache.org
>> Date: Monday, October 18, 2010, 10:26 PM
>> : 
>> : SELECT 
>> :   COUNT(*) 
>> : WHERE
>> :   date_column1 > :start_date AND
>> :   date_column2 > :end_date;
>> 
>>    q=*:*&fq=column1:[start TO
>> *]&fq=column2:[end TO *]&rows=0
>> 
>> ...every result includes a total count.
>> 
>> -Hoss
>> 

--------------------------
Grant Ingersoll
http://www.lucidimagination.com/

Search the Lucene ecosystem docs using Solr/Lucene:
http://www.lucidimagination.com/search


Re: count(*) equivilent in Solr/Lucene

Posted by Dennis Gearon <ge...@sbcglobal.net>.
I/my team will have to look at that and decode it,LOL! I get some of it.

The database version returns 1 row, with the answer.

What does this return and how fast is it on BIG indexes?

PS, that should have been:
.
.
.
   date_column2 < :end_date;
.

Dennis Gearon

Signature Warning
----------------
It is always a good idea to learn from your own mistakes. It is usually a better idea to learn from others’ mistakes, so you do not have to make them yourself. from 'http://blogs.techrepublic.com.com/security/?p=4501&tag=nl.e036'

EARTH has a Right To Life,
  otherwise we all die.


--- On Mon, 10/18/10, Chris Hostetter <ho...@fucit.org> wrote:

> From: Chris Hostetter <ho...@fucit.org>
> Subject: Re: count(*) equivilent in Solr/Lucene
> To: solr-user@lucene.apache.org
> Date: Monday, October 18, 2010, 10:26 PM
> : 
> : SELECT 
> :   COUNT(*) 
> : WHERE
> :   date_column1 > :start_date AND
> :   date_column2 > :end_date;
> 
>    q=*:*&fq=column1:[start TO
> *]&fq=column2:[end TO *]&rows=0
> 
> ...every result includes a total count.
> 
> -Hoss
> 

Re: count(*) equivilent in Solr/Lucene

Posted by Chris Hostetter <ho...@fucit.org>.
: 
: SELECT 
:   COUNT(*) 
: WHERE
:   date_column1 > :start_date AND
:   date_column2 > :end_date;

   q=*:*&fq=column1:[start TO *]&fq=column2:[end TO *]&rows=0

...every result includes a total count.

-Hoss