Solr version 6.1.0
Created a schema with some fields as indexed=true
on which I specifically want the solr main-query q
to search.
And also added more fields, which I just wanted to select, so marked them as stored=true
and indexed=false
.
Issue now is that, main query q=India
is searching on non-indexed fields like country, which I have specified in the image.
It is selecting the non-indexed field only when I specify the full value of non-indexed field.
How can I restrict solr from searching on non-index fields?
According to the screenshot above you're copying the content sent to the field country
into the field _text_
. When you're not giving Solr a specific field to search (i.e. you're not using one of the dismax handlers with qf
or not prefixing your term with the field name field:value
), it falls back to the default search field. This is set to _text_
by default. This field is indexed, and since you're copying the content from your country field into the _text_
field, the values from country
will give a hit.
If you don't want this to happen, don't copy the content from country
into _text_
, or give Solr the actual field you want to search.