2017-09-09 14 views
0

나는이 플러그인을 사용하는 방법을 알아 내려고 노력하고있어 내가 원하는대로Solr hon-lucene-synonyms 플러그인으로 다른 필드를 찾으십니까? 내가 실행하는 경우</p> <p><a href="https://github.com/healthonnet/hon-lucene-synonyms" rel="nofollow noreferrer">https://github.com/healthonnet/hon-lucene-synonyms</a></p> <p>:

http://solr.example.com/solr/graphics/select/?q=royalty+free&debugQuery=on&defType=synonym_edismax&synonyms=true

그것은 작동하고, 내가 얻을 디버깅을 통해 내가 원하는 것을 수행하고 있음을 알 수 있습니다.

<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)) 
(

http://solr.example.com/solr/graphics/select/?q= ({루씬 %의 20sow = 거짓 % 20df = 제목!의} %의 20royalty + 무료) % 20 ° 20 % : 나는 또한 더 사용하여 다른 필터를 아래로 결과를 축소 할 때

이 문제는 온다 has_fla : 1) & & debugQuery = & DEFTYPE = synonym_edismax & 동의어에 = 사실 난 그냥이 디버깅을 얻을

:

<lst name="reasonForNotExpandingSynonyms"> 
<str name="name">HasComplexQueryOperators</str> 
<str name="explanation"> 
synonyms.ignoreQueryOperators is set to false, and this query contains complex query operators (e.g. AND, OR, *, -, etc.). Complex queries aren't supported. 
</str> 
</lst> 

동의어 항목을 계속 유지하면서 다른 입력란을 검색하는 방법이 반드시 있어야합니다. 나는 SOLR을 사용하고 6.6.0

QueryParser처럼 solrconfig.xml 보이는 것입니다 :

그것은 가치가 무엇인지에 대한
<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> 

- 우리가 원하기 때문에 우리가이 플러그인을 사용하는 이유입니다 표준 설정 "로열티"와 "자유"와 우리가 원하는 해달라고 동의어, 2 개 별도의 단어로 취급으로

royalty free, cartoon, images, photos 

: 같은 - 여러 단어의 동의어를 사용합니다.

감사

답변

1

일부 의견 :

& FQ = has_fla : 당신은 그냥 필터로 추가하면 확실히 작동합니다 : '1 has_fla'에 의해 필터링

  • 1

    효과가있을뿐만 아니라 바람직합니다. 필터는 채점에 영향을 미치지 않으며 이후 쿼리를 위해 캐시됩니다.

  • 플러그인은 Solr 5.3.1까지의 버전을 가지고있는 것으로 보이며, 6.6과 함께 사용하려고하면 문제가 발생할 수 있습니다. 일반 Solr에서 'sow'및 'SynonymGraphFilter'로 작업하는 단어 동의어를 여러 개 사용할 수 없습니까? 확인 this

+0

오, 당신은 ledgend! 그것이 내가 필요한 것입니다!WRT 우리는 sow = false 아이디어를 사용하려고 시도했지만 작동하도록 만들지 못했습니다. (단지 동의어로 된 모든 단어를 별개의 단어로 취급하고 싶었습니다. 결과적으로 우리가 예상 한 결과를 얻지 못했습니다.) 어쨌든,이 트릭을 멋지게 할 것입니다 - 감사합니다! –

+0

도와 주셔서 매우 기쁩니다! – Persimmonium