使用外部文件建立自动建议

时间:2019-07-12 06:51:42

标签: solr apache-zookeeper solrcloud autosuggest

我正在尝试使用FileDictionaryFactory使用外部文件构建自动建议。但是,它总是期望来自zookeeper配置的文件。

如何提供外部位置,而不是上传到Zookeeper?

我正在solrconfig.xml中使用以下配置

<requestHandler name="/suggestdocid" class="solr.SearchHandler" startup="lazy" >
  <lst name="defaults">
    <str name="suggest">true</str>
    <str name="suggest.count">80</str>
    <str name="suggest.dictionary">suggestdocid</str>
  </lst>
  <arr name="components">
    <str>suggestdocid</str>
  </arr>
</requestHandler>

<searchComponent name="suggestdocid" class="solr.SuggestComponent">
 <lst name="suggester">
      <str name="name">suggestdocid</str>
      <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
      <str name="storeDir">suggester_analyzing_dir_docid_dict</str>
      <str name="highlight">false</str>

    <str name="dictionaryImpl">FileDictionaryFactory</str>
    <str name="sourceLocation">/var/lib/solr/doclist.txt</str>
      <str name="suggestAnalyzerFieldType">doc_token</str>
      <str name="exactMatchFirst">true</str>
      <str name="nonFuzzyPrefix">3</str>
      <str name="preserveSep">false</str>
      <str name="maxEdits">0</str>
      <str name="buildOnStartup">false</str>
  </lst>
</searchComponent>

以下是schema.xml中用于doc_token的配置

<fieldType name="doc_token" class="solr.TextField" positionIncrementGap="100">
      <analyzer type="index">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.WordDelimiterFilterFactory"
                splitOnCaseChange="0"
                splitOnNumerics="1"
                stemEnglishPossessive="0"
                generateWordParts="1"
                generateNumberParts="1"
                catenateWords="1"
                catenateNumbers="1"
                catenateAll="0" />
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
      </analyzer>
</fieldType>

当我尝试建立建议时,出现以下错误。

java.io.IOException: Error opening /configs/my-collection//var/lib/solr/doclist.txt

0 个答案:

没有答案