在 solr 中正确索引

Correct indexing in solr

当我为我的文件(docx、pdf、html)编制索引时,这些文件在我的索引中,但我无法在内容中进行搜索。 所以,搜索查询

http://localhost:8983/solr/gm_core/select?q=*:*&wt=json&indent=true

returns所有索引文件,但查询

http://localhost:8983/solr/gm_core/select?q=text:*&wt=json&indent=true

returns 0 匹配。


索引代码:

java -Dauto -Dc=gm_core -Drecursive -jar post.jar "{Path-to-a-file}"

我的相关部分schema.xml:

<field name="text_general" type="text_general" indexed="true" stored="false" multiValued="true" />
<field name="text_de"      type="text_de"      indexed="true" stored="false" multiValued="true" />
<field name="text"         type="text_general" indexed="true" stored="false" multiValued="true"/>

<copyfield source="*" dest="text" />

<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" />
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
  <analyzer type="query">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
    <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
</fieldType>

<fieldType name="text_de" class="solr.TextField" positionIncrementGap="100">
  <analyzer> 
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_de.txt" format="snowball" />
    <filter class="solr.GermanNormalizationFilterFactory"/>
    <filter class="solr.GermanLightStemFilterFactory"/>
  </analyzer>
</fieldType>

您似乎没有保存字段的内容。 尝试设置 "stored=true"

问题与复制字段声明有关。您使用了错误的(使用驼峰式)标签,因此无法复制数据。

<copyField source="*" dest="text"/>