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 Rohit Harchandani <rh...@gmail.com> on 2012/08/23 21:54:54 UTC

Bitmap field in solr

Hi all,
Is there any way to have a bitmap field in Solr??
I have a use case where I need to search specific attributes of a document.
Rather than having an is_A, is_B, is_C (all related to each other)etc...how
would i store all this data in a single field and still be able to query
it?? Can it be done in any way apart from storing them as strings in a text
field?
Thanks,
Rohit

Re: Bitmap field in solr

Posted by Erick Erickson <er...@gmail.com>.
There are a couple of open JIRAs, but native bitwise support isn't in
the code yet. See
SOLR-1913 and SOLR-1918

Best
Erick

On Thu, Aug 23, 2012 at 4:31 PM, Andy Lester <an...@petdance.com> wrote:
>
> On Aug 23, 2012, at 2:54 PM, Rohit Harchandani wrote:
>
>> Hi all,
>> Is there any way to have a bitmap field in Solr??
>> I have a use case where I need to search specific attributes of a document.
>> Rather than having an is_A, is_B, is_C (all related to each other)etc...how
>> would i store all this data in a single field and still be able to query
>> it?? Can it be done in any way apart from storing them as strings in a text
>> field?
>
>
> You can have a field that is multiValued.  It still needs a base type, like "string" or "int".  For instance, in my book database, I have a field called "classifications" and it is multivalued.
>
>             <field name="classifications"      type="string" multiValued="true" />
>
> A classification of 1 means "spiralbound", and 2 means "large print" and 3 means "multilingual" and so on.  So if my user wants to search for a multilingual book, I search for "classifications:3".  If you want spiralbound large print, you'd search for "classifications:1 classifications:2".
>
> xoa
>
> --
> Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance
>

Re: Bitmap field in solr

Posted by Andy Lester <an...@petdance.com>.
On Aug 23, 2012, at 2:54 PM, Rohit Harchandani wrote:

> Hi all,
> Is there any way to have a bitmap field in Solr??
> I have a use case where I need to search specific attributes of a document.
> Rather than having an is_A, is_B, is_C (all related to each other)etc...how
> would i store all this data in a single field and still be able to query
> it?? Can it be done in any way apart from storing them as strings in a text
> field?


You can have a field that is multiValued.  It still needs a base type, like "string" or "int".  For instance, in my book database, I have a field called "classifications" and it is multivalued.  

            <field name="classifications"      type="string" multiValued="true" />

A classification of 1 means "spiralbound", and 2 means "large print" and 3 means "multilingual" and so on.  So if my user wants to search for a multilingual book, I search for "classifications:3".  If you want spiralbound large print, you'd search for "classifications:1 classifications:2".

xoa

--
Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance