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 Hafiz Shafiq <hm...@gmail.com> on 2015/03/11 13:17:15 UTC

count documents using stored fields only in Apache solr

I am using solr 4.10.3. Documents are indexed using apache nutch 2.3. There
is a field in schema.xml that is tstamp that contains informas when
documents was indexed. This field is not indexed and stored only in solr. I
want to count no of documents indexed by nutch in solr. It is clear that I
have to use tstamp field. Now how I can do it?

Re: count documents using stored fields only in Apache solr

Posted by Shawn Heisey <ap...@elyograg.org>.
On 3/11/2015 6:17 AM, Hafiz Shafiq wrote:
> I am using solr 4.10.3. Documents are indexed using apache nutch 2.3. There
> is a field in schema.xml that is tstamp that contains informas when
> documents was indexed. This field is not indexed and stored only in solr. I
> want to count no of documents indexed by nutch in solr. It is clear that I
> have to use tstamp field. Now how I can do it?

If a field is not indexed, then you cannot do *any* searches on it.  Any
attempt to search on that field (without specifying additional valid OR
clauses) will return zero results.  You will not get an error, it will
just return nothing.

If you just need a count of the number of documents in the index, send
*:* as the query, assuming you're using lucene or edismax for the query
parser.  If you're using dismax, you need to set q.alt to *:* and either
send a blank query or leave the q parameter out entirely.  This q.alt
method also works for edismax.

Thanks,
Shawn