开发者

I'm not getting matches on my multi-valued fields

开发者 https://www.devze.com 2023-04-12 14:47 出处:网络
I have a couple of multi-valued fields in my schema, but when I search on terms that should produce results from these fields, no results come back.

I have a couple of multi-valued fields in my schema, but when I search on terms that should produce results from these fields, no results come back.

For example, in my schema there is a multi-valued field like this:

<field name="tag" type="text_general" indexed="true" stored="true" multiValued="true"/>

When I do a search on a tag with a query like this ...

{!dismax q.op=AND}test

I get results with "test" in the single-valued fields, but not in the multi-valued fields. I dump the results I get back from searching to verify what is stored.

(matches when I search "test")
name: TEST 4
description: i match the query "test"
year: 2010
id: 61

(does not match when I search "test")
name: BEST 4
description: i do not match the query
year: 2010
id: 68
tags: (array)
  0:test
  开发者_运维技巧1:test2
  2:i'm a test

I wasn't able to find similar problems with a search so I feel like I must have missed something. Can anyone point me in the right direction?


Are the tags included into the list of searchable fields ?
What are the fields you are searching on ? you might want to add tags.

As you are using defType as dismax, you can try passing qf=tags in url to test if the the document with name BEST 4 is returned with the results.

Example solrconfig.xml entry for searching on name, description and tags -

<requestHandler name="dismax" class="solr.SearchHandler">
   <lst name="defaults">
     <str name="echoParams">explicit</str>
     <str name="defType">dismax</str>
     <str name="qf">
        name description tags
     </str>
     <str name="q.alt">*:*</str>
     <str name="rows">10</str>
     <str name="fl">*,score</str>
   </lst>
</requestHandler>

use url as

q=test&qt=dismax
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号