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 giridhar <gi...@gmail.com> on 2013/11/14 16:45:48 UTC

Re: Query on multi valued field

Hi,

I want to search in a multivalued field.

For example, my field FormIds contains (1,2,3) as comma separated.

If i search for 1 or (1,2) or (1,3) or (2,3) or (1,2,3) any combination like
this should work.

How to define this multivalued integer field type.

Thankyou.



--
View this message in context: http://lucene.472066.n3.nabble.com/Query-on-multi-valued-field-tp3209343p4100937.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Query on multi valued field

Posted by Jack Krupansky <ja...@basetechnology.com>.
s/work/word/

"word delimiter filter"

-- Jack Krupansky

-----Original Message----- 
From: Jack Krupansky
Sent: Thursday, November 14, 2013 11:34 AM
To: solr-user@lucene.apache.org
Subject: Re: Query on multi valued field

I suppose you could define the field as tokenized text with the work
delimiter filter and with autogeneratePhraseQueries="false" and the default
query operator set to OR, and then queries might just work close enough to
what you want.

Otherwise...

You could do a custom update processor that parsed the string and expands it
into separate integer values for a multivalued field, and then you would
need to do either a custom query parser or a query preprocessor that
exapanded that special syntax into normal  Solr query syntax using AND or OR
as desired.

You could implement the update processor as a JavaScript script. The
simplest approach to the query side would be to expand the special query
syntax in your application layer.

-- Jack Krupansky

-----Original Message----- 
From: giridhar
Sent: Thursday, November 14, 2013 10:45 AM
To: solr-user@lucene.apache.org
Subject: Re: Query on multi valued field

Hi,

I want to search in a multivalued field.

For example, my field FormIds contains (1,2,3) as comma separated.

If i search for 1 or (1,2) or (1,3) or (2,3) or (1,2,3) any combination like
this should work.

How to define this multivalued integer field type.

Thankyou.



--
View this message in context:
http://lucene.472066.n3.nabble.com/Query-on-multi-valued-field-tp3209343p4100937.html
Sent from the Solr - User mailing list archive at Nabble.com. 


Re: Query on multi valued field

Posted by Jack Krupansky <ja...@basetechnology.com>.
I suppose you could define the field as tokenized text with the work 
delimiter filter and with autogeneratePhraseQueries="false" and the default 
query operator set to OR, and then queries might just work close enough to 
what you want.

Otherwise...

You could do a custom update processor that parsed the string and expands it 
into separate integer values for a multivalued field, and then you would 
need to do either a custom query parser or a query preprocessor that 
exapanded that special syntax into normal  Solr query syntax using AND or OR 
as desired.

You could implement the update processor as a JavaScript script. The 
simplest approach to the query side would be to expand the special query 
syntax in your application layer.

-- Jack Krupansky

-----Original Message----- 
From: giridhar
Sent: Thursday, November 14, 2013 10:45 AM
To: solr-user@lucene.apache.org
Subject: Re: Query on multi valued field

Hi,

I want to search in a multivalued field.

For example, my field FormIds contains (1,2,3) as comma separated.

If i search for 1 or (1,2) or (1,3) or (2,3) or (1,2,3) any combination like
this should work.

How to define this multivalued integer field type.

Thankyou.



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Query-on-multi-valued-field-tp3209343p4100937.html
Sent from the Solr - User mailing list archive at Nabble.com. 


Re: Query on multi valued field

Posted by Upayavira <uv...@odoko.co.uk>.
On Thu, Nov 14, 2013, at 03:45 PM, giridhar wrote:
> Hi,
> 
> I want to search in a multivalued field.
> 
> For example, my field FormIds contains (1,2,3) as comma separated.
> 
> If i search for 1 or (1,2) or (1,3) or (2,3) or (1,2,3) any combination
> like
> this should work.
> 
> How to define this multivalued integer field type.

Surely this is how multivalued fields work. If you had an integer field
type, that is defined as multiValued="true", then you can have three
values in that field, 1, 2 and 3.

Then, if you query for FormIds:(1 AND 2) will return all documents that
have both 1 and 2 in that field.

Am I missing something?

Upayavira