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 root23 <s....@gmail.com> on 2018/06/07 15:36:40 UTC

Query a particular index from a multivalued field.

Hi all,
is there a way i can query a particular index of a multivalued field.
e.g lets say i have a document like this
 doc 1= {
        "id": "1",
        "status": [
          "b",
          "a"
        ]
 }

doc2= {
        "id": "1",
        "status": [
          "c",
          "b"
        ]
 }

can i query like give me the document which has status = b at index 0. which
should only return doc 1.



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: Query a particular index from a multivalued field.

Posted by Erick Erickson <er...@gmail.com>.
there's no such syntax OOB.

You could append an index to it. So your input doc would look something like:

 doc 1= {
        "id": "1",
        "status": [
          "b1",
          "a2"
        ]
 }

and search appropriately.

Perhaps this would be a duplicated field used only when you wanted to
search by position.

Best,
Erick

On Thu, Jun 7, 2018 at 8:36 AM, root23 <s....@gmail.com> wrote:
> Hi all,
> is there a way i can query a particular index of a multivalued field.
> e.g lets say i have a document like this
>  doc 1= {
>         "id": "1",
>         "status": [
>           "b",
>           "a"
>         ]
>  }
>
> doc2= {
>         "id": "1",
>         "status": [
>           "c",
>           "b"
>         ]
>  }
>
> can i query like give me the document which has status = b at index 0. which
> should only return doc 1.
>
>
>
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html