Apache Solr - неправильный подсчет слов в функции termfreq - PullRequest
0 голосов
/ 07 августа 2020

Есть любое решение, чтобы использовать termfreq для pharse, а не одно слово (одно слово работает правильно), в pharse, например: termfreq (field, "test value") - не работает:

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.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>

1 Ответ

0 голосов
/ 07 августа 2020

Итак, новая схема. 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
}
]
}
}

А не рабочий: (* ​​1010 *

...