2014-09-02 10 views
1

我是solr和solr-4.6.0的新手。 設置後,我可以將文檔添加到索引。但是現在我想爲搜索字段和更新的schema.xml添加詞幹過濾器。 爲了讓它工作,我需要在我的本地機器上重新索引solr,然後才能在產品中進行更改。 Google-d提供了一套完整的步驟或程序,但沒有得到任何滿意的方法。 有人可以提供步驟嗎?完成模式更改時重新索引solr的完整步驟

回答

1

您只需再次運行相同的索引命令。任何具有相同唯一ID(如schema.xml中定義的)都將在提交時被覆蓋。如果你想幹淨的啓動,你可以停止實例並刪除整個索引目錄或運行delete all命令。

+0

謝謝@Alexandre。我正在尋找完整的命令來執行。 – 2014-09-10 09:03:42

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.