0

Sample tags field.

"tags":["[\"Rectangle\",\"Product\",\"Font\",\"Rectangle\",\"Product\",\"Rectangle\",\"Snack\",\"Product\",\"Material property\",\"Product\",\"Material property\"]"],

When I search the keyword land in the tags field I get the results that contain land vehicle

q=tags:land

"tags":["[\"Land vehicle\",\"Vehicle\"]"] - 

I do not want this to produce a match.

<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100" multiValued="true">
  <analyzer type="index">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.SynonymGraphFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/>
    <filter class="solr.StopFilterFactory" words="stopwords.txt" igno reCase="true"/>
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
</fieldType>

<field name="tags" type="text_general">

Screenshot of an example document with the tags field as described above

MatsLindh
  • 49,529
  • 4
  • 53
  • 84
  • Use String as the field type.. – Abhijit Bashetti Feb 04 '21 at 05:59
  • 1
    https://stackoverflow.com/questions/64640474/solr-search-not-giving-exact-result-for-single-word-term/64640531#64640531 – Abhijit Bashetti Feb 04 '21 at 06:00
  • I have changed my schema as below After changing, now I'm not getting any results Note: the field has values in comma separated "tags":["["Rectangle","Product","Font","Rectangle","Product","Rectangle","Snack","Product","Material property","Product","Material property"]"], – sarin Wickramasinghe Feb 04 '21 at 06:48
  • It seems like you have a JSON string indexed as a single string, instead of as separate fields? You should make that index separate values instead (by decoding it as JSON and then indexing it properly) - how does your indexing code look? What is actually returned with your document? – MatsLindh Feb 04 '21 at 08:10
  • @MatsLindh i have attached a image of a sample document – sarin Wickramasinghe Feb 04 '21 at 09:03
  • 1
    Yeah, that's broken data. You should deserialize it first, then add it as proper a proper mulivalued field. It's being sent as serialized JSON, which won't behave properly (i.e. the serialized string will be indexed as a single value). You should also add textual content as proper text in your question, since it will be far more accessible and searchable in those cases. – MatsLindh Feb 04 '21 at 09:38

0 Answers0