How to stop the result in solr when the phrase contains a stopwatch?

I have a problem finding with Solr a phrase that has temporary words. Solr sends the result using a stopwatch, and this is not my expected result.

I added the word "test" in the stopwords.txt file. In the schema.xml file, I have a type field

 <field name="searchword" type="text" indexed="true" stored="true" /> 

I indexed some data, and then tried to search the solr browser window as follows: searchword: "test" , and I did not get the result. Then again, I gave a phrase like searchword: "test data" , and I got the result. How to avoid such a scenario? If it contains the word stop, Solr should not give any result. How to stop the result in solr when the phrase contains a stop?

The following is the type of fieldType that I am using:

 <fieldType name="text" class="solr.TextField" positionIncrementGap="100"> <analyzer type="index"> <tokenizer class="solr.StandardTokenizerFactory"/> <filter class="solr.CommonGramsFilterFactory" words="stopwords.txt" ignoreCase="true"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/> </analyzer> <analyzer type="query"> <tokenizer class="solr.WhitespaceTokenizerFactory" /> <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" type="phrase"/> </analyzer> </fieldType> 

I need a solution for Solr does not give any result, while I give a phrase that contains the word (test)

+6
source share
1 answer

The word β€œstop” is a word that is not taken into account in the search; it is not a word that β€œstops” or cancels results. Therefore, the behavior you explain is correct: this is what stop words should do.

In SOLR, I don’t know how to β€œstop” a form of results that returns whenever you use a specific word (maybe someone has an idea?).

The only thing I can think of is: - Do not send the request to SOLR when you observe these conditions in the request :) - Remove the terms from the documents before indexing them (for example, using UpdateRequestProcessor), and use I-queries, Thus, whenever a term that is not indexed appears in the query, you will get zero results

+1
source

Source: https://habr.com/ru/post/902436/


All Articles