Hello Rajeswari,

As far as I know, Solr does not have a built in method to access a specific
index.

I can think in 3 ways to get the functionality you need:

1. Create a custom document transformer that return a specific index from a
multivalued field

2. Create a custom query function to do that

3. Store each value in its own field and add a copy field that unite them
all:

  <field name="X_1" type="string" indexed="false" stored="true"/>
  <field name="X_2" type="string" indexed="false" stored="true"/>
  <field name="X_3" type="string" indexed="false" stored="true"/>
  <field name="X_4" type="string" indexed="false" stored="true"/>
  <field name="X" type="string" indexed="true" stored="false"
multivalued="true"/>

  <copyField source="X_1" dest="X" />
  <copyField source="X_2" dest="X" />
  <copyField source="X_3" dest="X" />
  <copyField source="X_4" dest="X" />


The third method is probably the best, as if you know the number of
elements, it is not really a multivalued field, but a search on a multiple
fields.


If you don't mind changing the score a bit, another solution is to create 4
fields(X_1/2/3/4), this time make them both indexed and stored, and create
a field alias that will combine them all, then you can search on the field
alias.

On Mon, Jul 19, 2021, 10:11 PM Natarajan, Rajeswari
<rajeswari.natara...@sap.com.invalid> wrote:

> Hi,
>
> We have a multivakued field having always fixed number of values , 4 in
> each multivalued field
> For example
> 1st doc
> X = [“a” ,”ab
> “ , “abc” , abcd”]
>
> 2nd doc
> X=[“p”, “pq”, “pqr” , “pqrs”]
>
>
> Is there a way we can get  , “a” , “p”  as a query result , “ab” , “pq”
> as a query result   , based on the position in the list.
>
> Thanks,
> Rajeswari
>
>
>
>
>

Reply via email to