Search code examples
solrsolrj

Using logic AND in a text field


I'm using a schema that has a text field containing ids separated by spaces. The field definition in schema is below:

<field name="aux_identifiers" type="text" indexed="true" stored="true"/>

a query that fetch a single document returns the field as below - example:

<str name="aux_identifiers">1 2 3 4</str>

is there any possibility to apply a logic AND operator to these fields? I need to find the documents that has, as example, the ids 2 and 3 in the field.

fyi, we can't modifiy those fields to multivalued or array and reindex right now. that's why i'm trying a alternate solution.


Solution

  • It would depend on what kind of processing you have on that field, but this should work:

     q=aux_identifier:2  AND aux_identifier:3