使用Solr hon lucene同义词插件搜索其他字段?
我正在尝试找出如何使用此插件: 如果我跑步: 它可以按我想要的方式工作,我得到的调试结果告诉我它可以按我想要的方式工作:使用Solr hon lucene同义词插件搜索其他字段?,solr,solr6,Solr,Solr6,我正在尝试找出如何使用此插件: 如果我跑步: 它可以按我想要的方式工作,我得到的调试结果告诉我它可以按我想要的方式工作: <arr name="expandedSynonyms"> <str>art</str> <str>cartoon</str> <str>clip</str> <str>clipart</str> <str>graphics</str> &l
<arr name="expandedSynonyms">
<str>art</str>
<str>cartoon</str>
<str>clip</str>
<str>clipart</str>
<str>graphics</str>
<str>image</str>
<str>images</str>
<str>multimedia</str>
<str>picture</str>
<str>pictures</str>
<str>royalty free</str>
</arr>
+(((_text_:royalty) (_text_:free))^1.0 ((+((Synonym(_text_:art _text_:cartoon _text_:clip _text_:clipart _text_:graphics _text_:image _text_:images _text_:multimedia _text_:picture _text_:pictures _text_:royalty) _text_:free)))^1.0) ((+((Synonym(_text_:art _text_:cartoon _text_:cartoons _text_:clip _text_:clipart _text_:comic _text_:draw _text_:drawing _text_:drawings _text_:funny _text_:graphics _text_:image _text_:images _text_:multimedia _text_:picture _text_:pictures _text_:royalty _text_:sketch) _text_:free)))^1.0) ((+((Synonym(_text_:art _text_:cartoon _text_:clip _text_:clipart _text_:graphics _text_:image _text_:images _text_:multimedia _text_:picture _text_:pictures _text_:royalty) _text_:free)))^1.0) ((+((Synonym(_text_:art _text_:cartoon _text_:clip _text_:clipart _text_:graphics _text_:image _text_:images _text_:multimedia _text_:picture _text_:pictures _text_:royalty) _text_:free)))^1.0) ((+((Synonym(_text_:art _text_:cartoon _text_:clip _text_:clipart _text_:graphics _text_:image _text_:images _text_:multimedia _text_:picture _text_:pictures _text_:royalty) _text_:free)))^1.0) ((+((Synonym(_text_:art _text_:cartoon _text_:clip _text_:clipart _text_:graphics _text_:image _text_:images _text_:multimedia _text_:picture _text_:pictures _text_:royalty) _text_:free)))^1.0) ((+((Synonym(_text_:art _text_:cartoon _text_:clip _text_:clipart _text_:graphics _text_:image _text_:images _text_:multimedia _text_:picture _text_:pictures _text_:royalty) _text_:free)))^1.0) ((+((Synonym(_text_:art _text_:cartoon _text_:clip _text_:clipart _text_:graphics _text_:image _text_:images _text_:multimedia _text_:picture _text_:pictures _text_:royalty) _text_:free)))^1.0) ((+((Synonym(_text_:art _text_:cartoon _text_:clip _text_:clipart _text_:graphics _text_:image _text_:images _text_:multimedia _text_:picture _text_:pictures _text_:royalty) _text_:free)))^1.0) ((+((Synonym(_text_:art _text_:cartoon _text_:clip _text_:clipart _text_:graphics _text_:image _text_:images _text_:multimedia _text_:picture _text_:pictures _text_:royalty) _text_:free)))^1.0))
值得一提的是,我们之所以使用此插件,是因为我们希望使用多个同义词,例如:
royalty free, cartoon, images, photos
使用标准设置“版税”和“免费”,并在同义词中作为两个独立的词处理,这是我们不想要的
谢谢一些评论:
- 如果只是将“has_fla:1”作为筛选器添加,则通过它进行筛选肯定有效: &fq=具有以下功能:1 它不仅能起作用,而且是首选。过滤器不会影响评分,并将缓存以供以后查询
- 该插件的版本似乎只有Solr5.3.1,尝试将其与6.6结合使用可能会出现问题。你确定不能在纯Solr中使用多个单词同义词来处理“sow”和“同义词GraphFilter”吗?检查
<queryParser name="synonym_edismax" class="com.github.healthonnet.search.SynonymExpandingExtendedDismaxQParserPlugin">
<!-- You can define more than one synonym analyzer in the following list.
For example, you might have one set of synonyms for English, one for French,
one for Spanish, etc.
-->
<lst name="synonymAnalyzers">
<!-- Name your analyzer something useful, e.g. "analyzer_en", "analyzer_fr", "analyzer_es", etc.
If you only have one, the name doesn't matter (hence "myCoolAnalyzer").
-->
<lst name="myCoolAnalyzer">
<!-- We recommend a PatternTokenizerFactory that tokenizes based on whitespace and quotes.
This seems to work best with most people's synonym files.
For details, read the discussion here: http://github.com/healthonnet/hon-lucene-synonyms/issues/26
-->
<lst name="tokenizer">
<str name="class">solr.PatternTokenizerFactory</str>
<str name="pattern"><![CDATA[(?:\s|\")+]]></str>
</lst>
<!-- The ShingleFilterFactory outputs synonyms of multiple token lengths (e.g. unigrams, bigrams, trigrams, etc.).
The default here is to assume you don't have any synonyms longer than 4 tokens.
You can tweak this depending on what your synonyms look like. E.g. if you only have unigrams, you can remove
it entirely, and if your synonyms are up to 7 tokens in length, you should set the maxShingleSize to 7.
-->
<lst name="filter">
<str name="class">solr.ShingleFilterFactory</str>
<str name="outputUnigramsIfNoShingles">true</str>
<str name="outputUnigrams">true</str>
<str name="minShingleSize">2</str>
<str name="maxShingleSize">4</str>
</lst>
<!-- This is where you set your synonym file. For the unit tests and "Getting Started" examples, we use example_synonym_file.txt.
This plugin will work best if you keep expand set to true and have all your synonyms comma-separated (rather than =>-separated).
-->
<lst name="filter">
<str name="class">solr.SynonymFilterFactory</str>
<str name="tokenizerFactory">solr.KeywordTokenizerFactory</str>
<str name="synonyms">synonyms.txt</str>
<str name="expand">true</str>
<str name="ignoreCase">true</str>
</lst>
</lst>
</lst>
</queryParser>
royalty free, cartoon, images, photos