![](/img/trans.png)
[英]Apache Solr Querying by search term from multiple tables and in all columns
[英]Solr term search not searching all values from multifields value
我有 solr 字段
<field name="AllTitles" type="text_general" indexed="true" stored="false" multiValued="true"/>
<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<charFilter class="solr.MappingCharFilterFactory" mapping="mapping-ISOLatin1Accent.txt"/>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
<!-- in this example, we will only use synonyms at query time -->
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="false"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
輸入的 AllTitles 的值示例是
AllTitles: [ "Anything", "wuhan coronavirus", "anything" ]
AllTitles: [ "wuhan coronavirus", "anything", "anything" ]
它從第一個索引開始搜索,但如果索引上的任何匹配項不是第一個,那么它就不會搜索
例如,當我搜索
q="wuhan coronavirus"
我得到 2 個結果。 當我使用字段名稱“AllTitles”進行搜索時
q=AllTitles:"wuhan coronavirus"
我正確得到 7 個結果。
有人可以幫我確定問題嗎?
首先,在您的 SolrConfig.xml 中檢查“df”中定義了哪些字段。 在下面的示例中,它是“文本”。
<requestHandler name="/select" class="solr.SearchHandler">
<lst name="defaults">
<str name="echoParams">explicit</str>
<int name="rows">10</int>
<str name="df">text</str>
</requestHandler>
其次,在 schema.xml 或托管架構中,無論您使用的是哪個,請確保已將“AllTitles”復制到“text”。 像這樣,
<copyField source="AllTitles" dest="text"/>
在執行所有這些操作之前,您最好在查詢時將“AllTitles”添加到“df”參數中來測試它,就像 raghu777 提到的那樣。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.