我對使用Solr很新,但想問你的幫助。 我正在開發一個應該能夠突出顯示查詢結果的應用程序。對於此,我使用正則表達式分段器:避免在Solr上緩慢突出顯示,因爲阻止了
<highlighting>
<fragmenter name="regex" class="org.apache.solr.highlight.RegexFragmenter">
<lst name="defaults">
<int name="hl.fragsize">500</int>
<float name="hl.regex.slop">0.5</float>
<str name="hl.pre"><![CDATA[<b>]]></str>
<str name="hl.post"><![CDATA[</b>]]></str>
<str name="hl.useFastVectorHighlighter">true</str>
<str name="hl.regex.pattern">[-\w ,/\n\"']{20,300}[.?!]</str>
<str name="hl.fl">dokumentum_syn_query</str>
</lst>
該字段與索引詞條向量和偏移:
<field name="dokumentum_syn_query" type="huntext_syn" indexed="true" stored="true" multiValued="true" termVectors="on" termPositions="on" termOffsets="on"/>
<fieldType name="huntext_syn" class="solr.TextField" stored="true" indexed="true" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="com.morphologic.solr.huntoken.HunTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords_query.txt" enablePositionIncrements="true" />
<filter class="com.morphologic.solr.hunstem.HumorStemFilterFactory"
lex="/home/oroszgy/workspace/morpho/solrplugins/data/lex"
cache="alma"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords_query.txt" enablePositionIncrements="true" />
<filter class="com.morphologic.solr.hunstem.HumorStemFilterFactory"
lex="/home/oroszgy/workspace/morpho/solrplugins/data/lex"
cache="alma"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms_query.txt" ignoreCase="true" expand="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
高亮顯示效果很好,節選,它真的很慢。我意識到這是因爲熒光筆/碎片人員再次爲所有結果文檔起訴。
你能幫我嗎爲什麼會發生這種情況我應該如何避免這種情況? (我認爲使用fastvectorhighlighter將解決我的問題,但它沒有)
謝謝你的答案!之前我讀過關於tervVector的東西,正如你所看到的那樣,我試圖使用它。不幸的是,我可能使用了一些過時的文檔,並將值設置爲true,而不是true。這是一個竅門,它幫助我忽略了stemmin。 – oroszgy