簡體   English   中英

Apache Solr - termfreq function 中的字數錯誤

[英]Apache Solr - wrong count words in termfreq function

是否有任何解決方案,使用 termfreq 來表達,而不是一個詞(一個詞工作正確),如: termfreq(field,"test value") - 工作失敗:

架構.xml:

<fieldType name="text_books_index" class="solr.TextField">
        <analyzer type="index">
            <tokenizer class="solr.StandardTokenizerFactory"/>
            <filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
            <filter class="solr.LowerCaseFilterFactory"/>
            <filter class="solr.MorfologikFilterFactory"/>
            <filter class="solr.EdgeNGramFilterFactory" minGramSize="2" maxGramSize="15" />
        </analyzer>
        <analyzer type="query">
            <tokenizer class="solr.StandardTokenizerFactory"/>
            <filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
            <filter class="solr.LowerCaseFilterFactory"/>
            <filter class="solr.MorfologikFilterFactory"/>
        </analyzer>
    </fieldType>

所以,新的 schema.xml 字段類型:

<fieldType name="text_books_index" class="solr.TextField">
        <analyzer type="index">
            <tokenizer class="solr.StandardTokenizerFactory"/>
            <filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
            <filter class="solr.LowerCaseFilterFactory"/>
            <filter class="solr.MorfologikFilterFactory"/>
            <filter class="solr.ShingleFilterFactory" minShingleSize="2" maxShingleSize="4"/>
        </analyzer>
        <analyzer type="query">
            <tokenizer class="solr.StandardTokenizerFactory"/>
            <filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
            <filter class="solr.LowerCaseFilterFactory"/>
            <filter class="solr.MorfologikFilterFactory"/>
        </analyzer>
    </fieldType>

並現場聲明:

<field name="bookIndex" type="text_books_index" multiValued="false" indexed="true" required="true" stored="true"/>

和查詢:

{
"responseHeader": {
"zkConnected": true,
"status": 0,
"QTime": 1,
"params": {
"q": "bookIndex:\"search phraze\"~3 ",
"fl": "id,termfreq(bookIndex,\"search phraze\"),termfreq(title,\"search phraze\"),termfreq(author,\"search phraze\"),termfreq(isbn,\"search phraze\"),termfreq(notes,\"search phraze\"),termfreq(tableOfContent,\"search phraze\"),termfreq(descriptionBook,\"search phraze\")",
"start": "0",
"sort": "",
"fq": "",
"rows": "10"
}
},
"response": {
"numFound": 1,
"start": 0,
"docs": [
{
"id": "000",
"termfreq(bookIndex,\"search phraze\")": 0,
"termfreq(title,\"search phraze\")": 0,
"termfreq(author,\"search phraze\")": 0,
"termfreq(isbn,\"search phraze\")": 0,
"termfreq(notes,\"search phraze\")": 0,
"termfreq(tableOfContent,\"search phraze\")": 0,
"termfreq(descriptionBook,\"search phraze\")": 0
}
]
}
}

而且不工作:(

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM