2016-11-22 34 views
0

我在建議條款表單solr有一些問題。Solr不建議帶點內部的名稱

我有索引標題例如。 「foo.a123」,「foo.a456」...如果搜索「foo」Solr會將我作爲建議返回給我,但如果我搜索「foo.a」,則不會給出任何建議。如果我搜索 「foo a」,該建議可正常工作。

我使用了以下配置:

<fieldType name="textSpell" class="solr.TextField" positionIncrementGap="100" omitNorms="true"> 
     <analyzer type="index"> 
      <tokenizer class="solr.WhitespaceTokenizerFactory"/> 

      <filter class="solr.LowerCaseFilterFactory"/> 
      <filter class="solr.SynonymFilterFactory" synonyms="english/synonyms.txt" ignoreCase="true" expand="true"/> 
      <filter class="solr.StopFilterFactory" ignoreCase="true" words="english/stopwords.txt"/> 
      <filter class="solr.StandardFilterFactory" /> 
      <filter class="solr.RemoveDuplicatesTokenFilterFactory"/> 
     </analyzer> 
     <analyzer type="query"> 
      <tokenizer class="solr.WhitespaceTokenizerFactory" /> 

      <filter class="solr.LowerCaseFilterFactory"/> 
      <filter class="solr.StopFilterFactory" ignoreCase="true" words="english/stopwords.txt"/> 
      <filter class="solr.StandardFilterFactory" /> 
      <filter class="solr.RemoveDuplicatesTokenFilterFactory"/> 
     </analyzer> 
    </fieldType> 

備案的「咒語」正在使用textSpell配置

<field name="spell" type="textSpell" indexed="true" stored="false" multiValued="true"/> 
<copyField source="title" dest="spell"/> 
<copyField source="subTitle" dest="spell"/> 
<copyField source="content" dest="spell"/> 

提交的「咒語」作爲facet.field和小.prefix在這個例子中是'foo.a'

"facet_counts": { 
"facet_queries": {}, 
"facet_fields": { 
    "spell": [] 
}, 
"facet_dates": {}, 
"facet_ranges": {} 
} 

在此先感謝您的幫助。

+0

分析頁面對你投入該領域的內容說了什麼? (Solr的StandardFilterFactory [不做任何現代版本](https://cwiki.apache.org/confluence/display/solr/Filter+Descriptions#FilterDescriptions-StandardFilter),但是刪除了'.'和's'在早期版本中) – MatsLindh

+0

據我所知,我將搜索詞識別爲一個詞。請參閱https://i.stack.imgur.com/GVy9w.png – Lorenzo

回答

0

想通了,配置正在工作,張貼以上。 字Dilimeter也將工作,但不是我的情況所必需的。 (StandardFilterFactory只是什麼也沒有做。)

我完全誤解了字段配置上的stored="false"選項。我預計不需要將文檔重新寫入索引的行爲,但實際上該標誌定義了該字段是否可以在搜索結果中檢索。所以我只需要重新索引所有的文件。

謝謝你的幫助!

0

只需使用wordDelimiter過濾https://lucene.apache.org/core/4_4_0/analyzers-common/org/apache/lucene/analysis/miscellaneous/WordDelimiterFilter.html

<filter class="solr.WordDelimiterFilterFactory" types="wdfftypes.txt" generateNumberParts="0" stemEnglishPossessive="0" splitOnCaseChange="1" preserveOriginal="1" catenateAll="1" catenateWords="1" catenateNumbers="1" generateWordParts="1" splitOnNumerics="1"/> 

enter image description here

+0

實際上,詞表不是我想要的。我的問題是,我想用一個字符串作爲一個點保留字。我要更新這個問題。 – Lorenzo

0
solr.StandardFilterFactory 

該過濾器不再運行Solr中當luceneMatchVersion(solrconfig.xml中)大於 「3.1」 高。

Solr中4.10.4具有<luceneMatchVersion>4.10.4</luceneMatchVersion>

所以更換過濾器在您查詢分析器