在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
注意缺陷多动障碍,ADHD
Re-indexed Solr
但是当我搜索“ADHD”和“注意力缺陷多动障碍”时,结果的数量和排序是不同的。是否还有必要为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小时'} publishdate:[NOW / HOUR-24HOURS TO NOW / HOUR + 1HOUR] = 0,{!label ='Last 7天'} publishdate:[NOW / DAY-7DAYS TO NOW / DAY + 1DAY] = 0,{!label ='Last 30 days'} publishdate:[NOW / DAY-1MONTH TO NOW / DAY + 1DAY] = 0, {!label ='去年'} publishdate:[NOW / DAY-1YEAR to NOW / DAY + 1DAY] = 0},facet_fields = {drug_facet = {},company_facet = {},disease_facet = {}},facet_dates = { },facet_ranges = {}},突出= {},拼写检查= {建议= {correctlySpelled =假}}}