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 "vrparekh@gmail.com" <vr...@gmail.com> on 2011/11/02 13:32:32 UTC

how to apply sort and search both on multivalued field in solr

Hello all,

i did googling and also as per wiki, we can not apply sorting on multivalued
field.

workaround for that is we need to add two more fields for particular
multivalued field, min and max.
     e.g.     multivalued field have 4 values
                         "abc",
                         "cde",
                         "efg",
                         "pqr"
than min="abc" and max="pqr"    and we can make sort on it.

this is fine if there is only required to sort on multivalued field.  

but i want to do searching and sorting on same multivalued field, then
result would not fine.

how to solve this problem ?

Thanks
vishal parekh

--
View this message in context: http://lucene.472066.n3.nabble.com/how-to-apply-sort-and-search-both-on-multivalued-field-in-solr-tp3473652p3473652.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: how to apply sort and search both on multivalued field in solr

Posted by Erick Erickson <er...@gmail.com>.
Right, the behavior when sorting on a multivalued field is not defined, so
results are unreliable.


There's nothing that I know of that'll allow your sort to occur on the matched
terms in a multiValued field. But, again, defining correct behavior here isn't
easy. What if you searched for two terms and both terms matched a value in
a single document's multiValued field? Which term should it sort by?

Sorry, but sorting just doesn't work that way and I don't have any bright
ideas how to get this to work as you'd like....

Best
Erick

On Thu, Nov 3, 2011 at 1:06 PM, vrparekh@gmail.com <vr...@gmail.com> wrote:
> Thanks Erick,
>
> what i given 'abc',...etc...   its values of one multivalued field in one
> document, but might be its confusing.
>
> lets say, i have one field named  Array1   has multivalued=true
>
> now i want to Search on Array1 , but i want only affected values (which i
> can get in "highlighting"),  now i also want to sort on filed Array1,
>
> now whatever be the response should be sorted on only affected values (which
> contains search term).
>
> also without search sorting on Array1 sometimes works fine, sometimes not.
>
>
> Thanks
> Vishal Parekh
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/how-to-apply-sort-and-search-both-on-multivalued-field-in-solr-tp3473652p3477747.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: how to apply sort and search both on multivalued field in solr

Posted by "vrparekh@gmail.com" <vr...@gmail.com>.
Thanks Erick,

what i given 'abc',...etc...   its values of one multivalued field in one
document, but might be its confusing.

lets say, i have one field named  Array1   has multivalued=true

now i want to Search on Array1 , but i want only affected values (which i
can get in "highlighting"),  now i also want to sort on filed Array1,

now whatever be the response should be sorted on only affected values (which
contains search term).

also without search sorting on Array1 sometimes works fine, sometimes not.


Thanks 
Vishal Parekh

--
View this message in context: http://lucene.472066.n3.nabble.com/how-to-apply-sort-and-search-both-on-multivalued-field-in-solr-tp3473652p3477747.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: how to apply sort and search both on multivalued field in solr

Posted by Erick Erickson <er...@gmail.com>.
What does "sorting on a multivalued field" mean? Should the document
appear, in your example, in the a's? c's? e's? p's? There's no logical
place to sort a document into a list when there's more than one token that
makes sense in the general case that I can think of....

Why wouldn't searching oh your multivalued field and sorting on your
min and max fields give you what you want? Can you give an example?

Best
Erick

On Wed, Nov 2, 2011 at 8:32 AM, vrparekh@gmail.com <vr...@gmail.com> wrote:
> Hello all,
>
> i did googling and also as per wiki, we can not apply sorting on multivalued
> field.
>
> workaround for that is we need to add two more fields for particular
> multivalued field, min and max.
>     e.g.     multivalued field have 4 values
>                         "abc",
>                         "cde",
>                         "efg",
>                         "pqr"
> than min="abc" and max="pqr"    and we can make sort on it.
>
> this is fine if there is only required to sort on multivalued field.
>
> but i want to do searching and sorting on same multivalued field, then
> result would not fine.
>
> how to solve this problem ?
>
> Thanks
> vishal parekh
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/how-to-apply-sort-and-search-both-on-multivalued-field-in-solr-tp3473652p3473652.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>