4

我在 Solr 中遇到特定关键字的搜索结果不一致。

行为:

例如,关键字是“音乐”,并有 3 个包含此关键字的索引文档。

使用 URL“ http://abc.xyz.com:8983/solr/core3/select/?q=music ”使用此关键字执行搜索,当我们再次点击它时它将给出单个文档,它将返回所有三个索引文档。我们再次点击它将返回单个文档。这就是不一致的行为如何持续发生。

我无法想到是什么导致了这个问题。

是 Solr 缓存吗?它与其他 Solr 配置有关吗?

Solr 版本:3.6.1

来自 solrconfig.xml 的重要配置

<requestHandler name="/select" class="solr.SearchHandler">
    <lst name="defaults">
        <str name="echoParams">explicit</str>
        <int name="rows">50</int>
        <str name="df">keywords</str>
    </lst>
</requestHandler>
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
    <lst name="defaults">
        <str name="config">db-data-config-xsl.xml</str>
    </lst>  
</requestHandler>

<filterCache class="solr.FastLRUCache" size="512" initialSize="512" autowarmCount="0"/>
<queryResultCache class="solr.LRUCache" size="512" initialSize="512" autowarmCount="0"/>

架构.xml

        </analyzer>
    </fieldType>
    <fieldtype name="string"  class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
    <fieldType name="date" class="solr.TrieDateField" precisionStep="0" positionIncrementGap="0"/>
    <fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
    <fieldType name="sint" class="solr.SortableIntField" sortMissingLast="true" omitNorms="true"/>
    <fieldType name="tint" class="solr.TrieIntField" precisionStep="8" positionIncrementGap="0"/>
    <fieldType name="text" class="solr.TextField" positionIncrementGap="100">

        <analyzer type="query">
            <tokenizer class="solr.WhitespaceTokenizerFactory"/>
            <filter class="solr.LowerCaseFilterFactory"/>
            <filter class="solr.SnowballPorterFilterFactory" language="English"/>
        </analyzer>
    </fieldType>
    <fieldType name="shingleString" class="solr.TextField" positionIncrementGap="100" omitNorms="true">
        <analyzer type="index">
            <tokenizer class="solr.KeywordTokenizerFactory"/>
        </analyzer>
        <analyzer type="query">
            <tokenizer class="solr.WhitespaceTokenizerFactory"/>

            <filter class="solr.PositionFilterFactory" />
        </analyzer>
    </fieldType>
    <fieldType name="facet_tex" class="solr.TextField" sortMissingLast="true" omitNorms="true">
        <analyzer>

            <tokenizer class="solr.KeywordTokenizerFactory"/>   
            <filter class="solr.LowerCaseFilterFactory" />
            <!-- The TrimFilter removes any leading or trailing whitespace -->
            <filter class="solr.TrimFilterFactory" />        
            <!--filter class="solr.PatternReplaceFilterFactory"  pattern="([^a-z])" replacement="" replace="all"   /-->
        </analyzer>
    </fieldType>

    <fieldType name="facet_comma" class="solr.TextField" sortMissingLast="true" omitNorms="true">
        <analyzer>
            <tokenizer class="solr.PatternTokenizerFactory" pattern=","/>

            <filter class="solr.LowerCaseFilterFactory" />
            <!-- The TrimFilter removes any leading or trailing whitespace -->
            <filter class="solr.TrimFilterFactory" />   
            <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>             
            <!--filter class="solr.PatternReplaceFilterFactory"  pattern="([^a-z])" replacement="" replace="all"   /-->
        </analyzer>
    </fieldType>

        <fieldType name="text_auto" class="solr.TextField">
            <analyzer>
                <tokenizer class="solr.PatternTokenizerFactory" pattern=","/>
                <filter class="solr.LowerCaseFilterFactory"/>
                <filter class="solr.TrimFilterFactory" />  
                <filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="25" side="front" />
            </analyzer>
        </fieldType>


    <fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
        <analyzer type="index">
            <tokenizer class="solr.StandardTokenizerFactory"/>
            <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />

            <filter class="solr.LowerCaseFilterFactory"/>
        </analyzer>
        <analyzer type="query">
            <tokenizer class="solr.StandardTokenizerFactory"/>
            <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
            <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
            <filter class="solr.LowerCaseFilterFactory"/>
        </analyzer>
    </fieldType>
    <fieldType name="text_en" class="solr.TextField" positionIncrementGap="100">
        <analyzer type="index">
            <charFilter class="solr.PatternReplaceCharFilterFactory" pattern="," replacement=" "/>

            <tokenizer class="solr.WhitespaceTokenizerFactory"/>

            <filter class="solr.LowerCaseFilterFactory"/>

        </analyzer>
        <analyzer type="query">
            <charFilter class="solr.PatternReplaceCharFilterFactory" pattern="," replacement=" "/>

            <tokenizer class="solr.WhitespaceTokenizerFactory"/>

            <filter class="solr.LowerCaseFilterFactory"/>

        </analyzer>
    </fieldType>
    <fieldType name="text_en_comma" class="solr.TextField" positionIncrementGap="100">
        <analyzer type="index">

            <charFilter class="solr.PatternReplaceCharFilterFactory" pattern="," replacement=" "/>

            <tokenizer class="solr.WhitespaceTokenizerFactory"/>
            <filter class="solr.TrimFilterFactory" />

            <filter class="solr.StopFilterFactory"
            ignoreCase="true"
            words="lang/stopwords_en.txt"
            enablePositionIncrements="true" />
            <filter class="solr.LowerCaseFilterFactory"/>
            <filter class="solr.EnglishPossessiveFilterFactory"/>
            <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>

        </analyzer>
        <analyzer type="query">

            <tokenizer class="solr.WhitespaceTokenizerFactory"/>
            <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
            <filter class="solr.StopFilterFactory"
            ignoreCase="true"
            words="lang/stopwords_en.txt"
            enablePositionIncrements="true"                />
            <filter class="solr.LowerCaseFilterFactory"/>
            <filter class="solr.EnglishPossessiveFilterFactory"/>

        </analyzer>
    </fieldType>

    <fieldType name="alphaOnlySort" class="solr.TextField" sortMissingLast="true" omitNorms="true">
        <analyzer>
            <tokenizer class="solr.KeywordTokenizerFactory"/>

            <filter class="solr.LowerCaseFilterFactory" />

            <filter class="solr.TrimFilterFactory" />

            <filter class="solr.PatternReplaceFilterFactory"
            pattern="([^a-z])" replacement="" replace="all"/>
        </analyzer>
    </fieldType>
    <fieldType name="text_en_suggest" class="solr.TextField" positionIncrementGap="100" omitNorms="true">
        <analyzer type="index">
            <tokenizer class="solr.PatternTokenizerFactory" pattern=","/>
            <filter class="solr.TrimFilterFactory" />
            <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_en.txt" enablePositionIncrements="true" />
            <filter class="solr.LowerCaseFilterFactory"/>
            <filter class="solr.EnglishPossessiveFilterFactory"/>
        </analyzer>
        <analyzer type="query">
            <tokenizer class="solr.PatternTokenizerFactory" pattern=","/>
            <filter class="solr.TrimFilterFactory" />
            <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_en.txt" enablePositionIncrements="true"/>
            <filter class="solr.LowerCaseFilterFactory"/>
            <filter class="solr.EnglishPossessiveFilterFactory"/>
        </analyzer>
    </fieldType>
</types>

<fields>   

    <field name="section"     type="string"    indexed="true"  stored="true"  multiValued="false" /> 
    <field name="url"    type="string"    indexed="false"  stored="true"  multiValued="false" /> 
    <field name="title"    type="string"    indexed="true"  stored="true"  multiValued="false" /> 
    <field name="description"     type="string"    indexed="true"  stored="true"  multiValued="false" /> 
    <field name="keywords"     type="text_en_comma"    indexed="true"  stored="true"  multiValued="true" /> 
    <field name="category"    type="facet_comma"    indexed="true"  stored="true"  multiValued="false" />  
    <field name="robots"    type="string"    indexed="true"  stored="true"  multiValued="false" />  
    <field name="keywords_suggest"     type="text_en_suggest"    indexed="true"  stored="true"  multiValued="true" /> 

</fields>

<copyField source="keywords" dest="keywords_suggest"/>



<uniqueKey>title</uniqueKey>


<defaultSearchField>keywords</defaultSearchField>


<solrQueryParser defaultOperator="AND"/>

如果有人可以指导将不胜感激。

谢谢, 巴韦什

4

1 回答 1

0

检查你的参数timeAllowed,它可以在 solrconfix.xml 的一些处理程序中描述

还有问题:你的索引有多大?文档如何,最好查看您的 solrconfix.xml 和 scheme.xml 文件。

于 2013-03-25T23:40:01.167 回答