Solr给我的结果是没有白色空间的自动提示

时间:2015-01-13 10:32:05

标签: jquery ajax xml solr

我是SOLR的新手。我们要求显示自动建议。我已经实现了solr auto建议。但是,在执行自动建议查询时,我收到的响应没有空格。

当我执行选择查询时,我能够看到原始数据。

我已尝试使用" WhitespaceTokenizerFactory"和" StandardTokenizerFactory"在schema.xml中。但仍然有同样的问题。

下面是我的schema.xml和solrconfig.xml文件。

schema.xml中

<analyzer type="index">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.StandardFilterFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
</analyzer>

<analyzer type="query">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.StandardFilterFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
</analyzer>

solrconfig.xml中:

<searchComponent class="solr.SpellCheckComponent" name="autosuggest">
    <lst name="spellchecker">
      <str name="name">autosuggest</str>
      <str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
      <str name="lookupImpl">org.apache.solr.spelling.suggest.fst.AnalyzingLookupFactory</str>
      <str name="dictionaryImpl">DocumentDictionaryFactory</str>
      <str name="storeDir">autosuggest</str>
      <str name="buildOnCommit">true</str>
      <str name="field">content</str>
      <str name="suggestAnalyzerFieldType">text_asug</str>

      <bool name="preserveSep">true</bool>
      <!-- Suggester properties 
      <bool name="exactMatchFirst">true</bool>-->
    </lst>
</searchComponent>
<requestHandler class="org.apache.solr.handler.component.SearchHandler" name="/autosuggest">
    <lst name="defaults">
      <str name="spellcheck">true</str>
      <str name="spellcheck.dictionary">autosuggest</str>
      <str name="spellcheck.onlyMorePopular">true</str>
      <str name="spellcheck.count">5</str>
      <str name="spellcheck.collate">true</str>
    </lst>
    <arr name="components">
      <str>autosuggest</str>
    </arr>
</requestHandler>

,回复是:

<?xml version="1.0" encoding="UTF8"?>
<response>
    <lst name="responseHeader">
        <int name="status">0</int>
        <int name="QTime">2</int>
    </lst>

    <lst name="spellcheck">
        <lst name="suggestions">
            <lst name="venusPressRelease">
                <int name="numFound">1</int>
                <int name="startOffset">9</int>
                <int name="endOffset">26</int>
                <arr name="suggestion">
                    <str>venuspressrelease</str>
                </arr>

            </lst>
            <str name="collation">content:"venuspressrelease"</str>
        </lst>
    </lst>
</response>

预期的回应是:

<arr name="suggestion">
    <str>venus press release</str>
</arr>

有人可以建议问题出在哪里吗?

0 个答案:

没有答案