【问题标题】:Complete steps to re-index solr when making a schema change进行架构更改时重新索引 solr 的完整步骤
【发布时间】:2014-09-10 17:30:43
【问题描述】:

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

【问题讨论】:

    标签: solr solr4


    【解决方案1】:

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

    【讨论】:

    • 谢谢@Alexandre。我正在寻找要执行的完整命令。
    【解决方案2】:
    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.
    

    【讨论】:

      猜你喜欢
      • 2014-04-03
      • 2020-07-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-22
      • 2017-07-06
      • 2014-05-29
      • 1970-01-01
      • 2011-08-27
      相关资源
      最近更新 更多