完成架构更改时完成重新索引solr的步骤

时间:2014-09-02 06:22:25

标签: solr solr4

我是solr并使用solr-4.6.0的新手。 设置完成后,我可以将文档添加到索引中。但现在我想为搜索字段和更新的schema.xml添加词干过滤器。 为了使它工作,我需要先在我的本地机器上重新索引solr,然后再对prod进行更改。 Google-d提供了一整套步骤或程序,但没有得到任何令人满意的方法。 有人可以提供步骤吗?

2 个答案:

答案 0 :(得分:1)

您只需再次运行相同的索引命令。具有相同唯一ID(在schema.xml中定义)的任何内容都将在提交时被覆盖。如果要干净启动,可以停止实例并删除整个索引目录或运行delete all命令。

答案 1 :(得分:1)

Ok, now I've moved 2 steps forward. I've created data-config.xml and put SolrEntityProcessor as datasource as I don't want to delete and re build the index. Solr reload is working fine, but on runing fulldata import, it throws error. Here are the files:

data-config.xml:

<dataConfig>
  <document name="SolrIndex">
    <entity name="SolrIndex_Data" processor="SolrEntityProcessor" url="http://quovantis-hp-15-notebook-pc:8081/solr-4.6.0/#/collection1" query="*:*"/>
  </document>
</dataConfig>

solr-config.xml:

<config>
<lib dir="../../dist/" regex="apache-solr-dataimporthandler-\d.*\.jar" />
  <lib dir="../../contrib/dataimporthandler/lib/" regex=".*\.jar" />
</config>

schema.xml:

<schema name="example" version="1.5">
<fields>
<field name="entityData" type="text_stem" stored="true" indexed="true" multiValued="false" />
</fields>
<types>
<fieldType name="text_stem" class="solr.TextField" positionIncrementGap="100">
      <analyzer type="index">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.StopFilterFactory"
                ignoreCase="true"
                words="stopwords.txt"
                enablePositionIncrements="true"
                />
        <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
        <filter class="solr.LowerCaseFilterFactory"/>      
        <filter class="solr.PorterStemFilterFactory" />
      </analyzer>
      0
      <analyzer type="query">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.StopFilterFactory"
                ignoreCase="true"
                words="stopwords.txt"
                enablePositionIncrements="true"
                />
        <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.PorterStemFilterFactory"/>
      </analyzer>
    </fieldType>
</types>


Error:
{
  "responseHeader": {
    "status": 0,
    "QTime": 0
  },
  "initArgs": [
    "defaults",
    [
      "config",
      "data-config.xml"
    ]
  ],
  "command": "status",
  "status": "idle",
  "importResponse": "",
  "statusMessages": {
    "Time Elapsed": "0:0:22.403",
    "Total Requests made to DataSource": "0",
    "Total Rows Fetched": "0",
    "Total Documents Processed": "0",
    "Total Documents Skipped": "0",
    "Full Dump Started": "2014-09-10 14:55:03",
    "": "Indexing failed. Rolled back all changes.",
    "Rolledback": "2014-09-10 14:55:04"
  },
  "WARNING": "This response format is experimental.  It is likely to change in the future."
}

I've followed some post to run this. Not sure where the issue is.