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 Andrew Nagy <an...@villanova.edu> on 2007/08/03 17:38:13 UTC

Facet on certain characters

Hello, I was wondering if there is a way to facet on certain characters of a field.  For example, I would like to get a facet count on how many of my titles start with the letter A, B, C, etc.

Is this possible with SOLR?

Thanks
Andrew

Re: Facet on certain characters

Posted by Mike Klaas <mi...@gmail.com>.
On 3-Aug-07, at 8:38 AM, Andrew Nagy wrote:

> Hello, I was wondering if there is a way to facet on certain  
> characters of a field.  For example, I would like to get a facet  
> count on how many of my titles start with the letter A, B, C, etc.
>
> Is this possible with SOLR?

Will's solution is the most performant, but you can also issue a  
series of facet queries:

? 
q=...&facet.query=title:a*&facet.query=title:b*&facet.query=title:c*&...

Now, if this doesn't have to be query-specific (you want the global  
counts), you can use TermDocs to get the answer quickly.

-MIke

RE: Facet on certain characters

Posted by Will Johnson <wj...@GETCONNECTED.COM>.
Create a new field with the first character only, facet on that.  Less
memory, less overall work.

- will

-----Original Message-----
From: Andrew Nagy [mailto:andrew.nagy@villanova.edu] 
Sent: Friday, August 03, 2007 11:38 AM
To: solr-user@lucene.apache.org
Subject: Facet on certain characters

Hello, I was wondering if there is a way to facet on certain characters
of a field.  For example, I would like to get a facet count on how many
of my titles start with the letter A, B, C, etc.

Is this possible with SOLR?

Thanks
Andrew