在中添加了以下内容
schema.xml
:<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100"> <analyzer type="index"> <tokenizer class="solr.StandardTokenizerFactory"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true"/> <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/> <!-- in this example, we will only use synonyms at query time <filter class="solr.SynonymFilterFactory" synonyms="index_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" enablePositionIncrements="true"/> <!--<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>--> <filter class="solr.LowerCaseFilterFactory"/> </analyzer>
Synonym.txt
注意缺陷多动障碍,多动症
Re-indexed Solr
但是当我搜索“注意力缺陷多动障碍”和“注意力缺陷多动障碍”时,结果的数量和排序是不同的。Solr 是否需要进行更多配置才能识别 synonym.txt 并为两个搜索提供相同的结果?
@dwhelan - 搜索 ms 的查询看起来像 '((drug_facet_auto:((ms*)))OR(company_facet_auto:((ms*)))OR(disease_facet_auto:((ms*))))' 和QueryResponse : {responseHeader={status=0,QTime=15,params={facet=true,q=((drug_facet_auto:((ms*)))OR(company_facet_auto:((ms*)))OR(disease_facet_auto:( (ms*)))),facet.limit=100,facet.field=[drug_facet, company_facet, disease_facet],wt=javabin,rows=0,version=2}},response={numFound=0,start=0 ,docs=[]},facet_counts={facet_queries={{!label='过去 24 小时'}发布日期:[NOW/HOUR-24HOURS TO NOW/HOUR+1HOUR]=0,{!label='过去 7 天' }publishdate:[NOW/DAY-7DAYS TO NOW/DAY+1DAY]=0,{!label='过去 30 天'}publishdate:[NOW/DAY-1MONTH TO NOW/DAY+1DAY]=0,{!label ='去年'}发布日期:[NOW/DAY-1YEAR TO NOW/DAY+1DAY]=0},facet_fields={drug_facet={},company_facet={},disease_facet={}},facet_dates={},facet_ranges={}},highlighting={},spellcheck={suggestions={correctlySpelled=false}}}