找到你要的答案

Q:Solr stopwords gets indexed but returns 0 results

Q:Solr构建索引但会返回0个结果

I am trying not to index stopwords for all the Textfields.

My managed-schema.xml looks like:

<fieldType name="text_en" class="solr.TextField" positionIncrementGap="100">
    <analyzer>
      <tokenizer class="solr.StandardTokenizerFactory"/>
      <filter class="solr.StopFilterFactory" words="lang/stopwords_en.txt" ignoreCase="true"/>
      <filter class="solr.LowerCaseFilterFactory"/>
      <filter class="solr.EnglishPossessiveFilterFactory"/>
      <filter class="solr.PorterStemFilterFactory"/>
   </analyzer>
 </fieldType>
<field name="ItemDesc" type="text_en" multiValued="false" indexed="true" stored="false"/>

However when I look at the solr field description it does show me the stop words in the "load term info" tab screenshot

However when I click on the stopword like "on" it gives me 0 results. screenshot

So is solr indexing the stopwords or not?

I looked at the solr documentation and it says: "Clicking that button will show the top N terms that are in the index for that field" which means that stopwords like "on" are indexed however when I click on the word it returns 0 results for only all the stopwords.

我不想为所有的文本框的指标构建。

我managed-schema.xml看起来像:

<fieldType name="text_en" class="solr.TextField" positionIncrementGap="100">
    <analyzer>
      <tokenizer class="solr.StandardTokenizerFactory"/>
      <filter class="solr.StopFilterFactory" words="lang/stopwords_en.txt" ignoreCase="true"/>
      <filter class="solr.LowerCaseFilterFactory"/>
      <filter class="solr.EnglishPossessiveFilterFactory"/>
      <filter class="solr.PorterStemFilterFactory"/>
   </analyzer>
 </fieldType>
<field name="ItemDesc" type="text_en" multiValued="false" indexed="true" stored="false"/>

但是当我看Solr字段描述它让我停止的话,在“加载项信息”选项卡截图

但是当我点击的词像“这给我带来了0个结果。截图

所以Solr索引的构建或不?

I looked at the solr documentation and it says: "Clicking that button will show the top N terms that are in the index for that field" which means that stopwords like "on" are indexed however when I click on the word it returns 0 results for only all the stopwords.

answer1: 回答1:

So I finally figured out the problem. The schema file is correctly filtering out the stopwords. The problem is the PorterstemFilterfactory which stems the keywords such as "one" to "on" and "use" to "us" and indexing them making it look like the stopwords are not filtered out. I dont know if this is a bug in Porterstem or it is suppose to be that way.

So I finally figured out the problem. The schema file is correctly filtering out the stopwords. The problem is the PorterstemFilterfactory which stems the keywords such as "one" to "on" and "use" to "us" and indexing them making it look like the stopwords are not filtered out. I dont know if this is a bug in Porterstem or it is suppose to be that way.

solr  lucene