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 William Pierce <ev...@hotmail.com> on 2009/12/04 20:43:25 UTC

Best way to handle bitfields in solr...

Folks:

In my db I currently have fields that represent bitmasks.   Thus, for example, a value of the mask of 48 might represent an "undergraduate" (value = 16) and "graduate" (value = 32).   Currently,  the corresponding field in solr is a multi-valued string field called "EdLevel" which will have <value>Undergraduate</value> and <value>Graduate</value>  as its two values (for this example).   I do the conversion from the int into the list of values as I do the indexing.

Ideally, I'd like solr to have bitwise operations so that I could store the int value, and then simply search by using bit operations.  However, given that this is not possible,  and that there have been recent threads speaking to performance issues with multi-valued fields,  is there something better I could do?

TIA,

- Bill

Re: Best way to handle bitfields in solr...

Posted by Israel Ekpo <is...@gmail.com>.
William,

This QParserPlugin should solve that problem now.

Check out https://issues.apache.org/jira/browse/SOLR-1913

BitwiseQueryParserPlugin is a org.apache.solr.search.QParserPlugin that
allows users to filter the documents returned from a query by performing
bitwise operations between a particular integer field in the index and the
specified value.

The plugin is available immediately for your use.

On Fri, Dec 4, 2009 at 4:03 PM, Otis Gospodnetic <otis_gospodnetic@yahoo.com
> wrote:

> Would http://wiki.apache.org/solr/FunctionQuery#fieldvalue help?
>
>  Otis
> --
> Sematext -- http://sematext.com/ -- Solr - Lucene - Nutch
>
>
>
> ----- Original Message ----
> > From: William Pierce <ev...@hotmail.com>
> > To: solr-user@lucene.apache.org
> > Sent: Fri, December 4, 2009 2:43:25 PM
> > Subject: Best way to handle bitfields in solr...
> >
> > Folks:
> >
> > In my db I currently have fields that represent bitmasks.   Thus, for
> example, a
> > value of the mask of 48 might represent an "undergraduate" (value = 16)
> and
> > "graduate" (value = 32).   Currently,  the corresponding field in solr is
> a
> > multi-valued string field called "EdLevel" which will have
> > Undergraduate and Graduate  as its two values (for
> > this example).   I do the conversion from the int into the list of values
> as I
> > do the indexing.
> >
> > Ideally, I'd like solr to have bitwise operations so that I could store
> the int
> > value, and then simply search by using bit operations.  However, given
> that this
> > is not possible,  and that there have been recent threads speaking to
> > performance issues with multi-valued fields,  is there something better I
> could
> > do?
> >
> > TIA,
> >
> > - Bill
>
>


-- 
"Good Enough" is not good enough.
To give anything less than your best is to sacrifice the gift.
Quality First. Measure Twice. Cut Once.
http://www.israelekpo.com/

Re: Best way to handle bitfields in solr...

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Would http://wiki.apache.org/solr/FunctionQuery#fieldvalue help?

 Otis
--
Sematext -- http://sematext.com/ -- Solr - Lucene - Nutch



----- Original Message ----
> From: William Pierce <ev...@hotmail.com>
> To: solr-user@lucene.apache.org
> Sent: Fri, December 4, 2009 2:43:25 PM
> Subject: Best way to handle bitfields in solr...
> 
> Folks:
> 
> In my db I currently have fields that represent bitmasks.   Thus, for example, a 
> value of the mask of 48 might represent an "undergraduate" (value = 16) and 
> "graduate" (value = 32).   Currently,  the corresponding field in solr is a 
> multi-valued string field called "EdLevel" which will have 
> Undergraduate and Graduate  as its two values (for 
> this example).   I do the conversion from the int into the list of values as I 
> do the indexing.
> 
> Ideally, I'd like solr to have bitwise operations so that I could store the int 
> value, and then simply search by using bit operations.  However, given that this 
> is not possible,  and that there have been recent threads speaking to 
> performance issues with multi-valued fields,  is there something better I could 
> do?
> 
> TIA,
> 
> - Bill