Solr RELOAD更改/恢复架构更改

时间:2015-04-23 15:52:27

标签: solr datastax

我做的步骤:

  1. curl -u cassandra“http://localhost:8983/solr/admin/cores?action=CREATE&name=tweets.tweets_test&generateResources=true&reindex=true&deleteAll=true
  2. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <schema name="autoSolrSchema" version="1.5">
    <types>
    <fieldType class="org.apache.solr.schema.TextField" name="TextField">
    <analyzer>
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    </analyzer>
    </fieldType>
    <fieldType class="org.apache.solr.schema.TrieDateField" name="TrieDateField"/>
    <fieldType class="org.apache.solr.schema.TrieLongField" name="TrieLongField"/>
    </types>
    <fields>
    <field indexed="true" multiValued="true" name="atnames" stored="true" type="TextField"/>
    <field indexed="true" multiValued="true" name="links" stored="true" type="TextField"/>
    <field indexed="true" multiValued="false" name="tweet_date" stored="true" type="TrieDateField"/>
    <field indexed="true" multiValued="false" name="tweet" stored="true" type="TextField"/>
    <field indexed="true" multiValued="true" name="hashtags" stored="true" type="TextField"/>
    <field indexed="true" multiValued="false" name="uid" stored="true" type="TrieLongField"/>
    <field indexed="true" multiValued="false" name="tweet_id" stored="true" type="TrieLongField"/>
    </fields>
    <uniqueKey>(uid,tweet_id)</uniqueKey>
    </schema>

    我会将架构更改为(我想使用KeywordTokenizerFactory索引网址):

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <schema name="autoSolrSchema" version="1.5">
    <types>
        <fieldType class="org.apache.solr.schema.TextField" name="TextField">
        <analyzer>
            <tokenizer class="solr.StandardTokenizerFactory"/>
            <filter class="solr.LowerCaseFilterFactory"/>
        </analyzer>
        </fieldType>
    
        <fieldType class="org.apache.solr.schema.TextField" name="TextFieldURL">
        <analyzer>
            <tokenizer class="solr.KeywordTokenizerFactory"/>
        </analyzer>
        </fieldType>
    
        <fieldType class="org.apache.solr.schema.TrieDateField" name="TrieDateField"/>
        <fieldType class="org.apache.solr.schema.TrieLongField" name="TrieLongField"/>
    </types>
    
    
    <fields>
    <field indexed="true" multiValued="true" name="atnames" stored="true" type="TextField"/>
    <field indexed="true" multiValued="true" name="links" stored="true" type="TextFieldURL"/>
    <field indexed="true" multiValued="false" name="tweet_date" stored="true" type="TrieDateField"/>
    <field indexed="true" multiValued="false" name="tweet" stored="true" type="TextField"/>
    <field indexed="true" multiValued="true" name="hashtags" stored="true" type="TextField"/>
    <field indexed="true" multiValued="false" name="uid" stored="true" type="TrieLongField"/>
    <field indexed="true" multiValued="false" name="tweet_id" stored="true" type="TrieLongField"/>
    </fields>
    <uniqueKey>(uid,tweet_id)</uniqueKey>
    </schema>

    1. 让我们上传更改: curl“http://localhost:8983/solr/resource/tweets.tweets_test/schema.xml” - data-binary @ tweets.tweets_test.xml -H'Content-type:text / xml;字符集= UTF-8'

    2. 获取最新架构以确保其成功上传: http://localhost:8983/solr/tweets.tweets_test/admin/file?file=schema.xml&contentType=text/xml;charset=utf-8

    3. 看起来不错 - 我看到了我的变化。 (顺便说一句,我所做的更改不起作用,链接仍然被编入索引:“t.co”,“http”,......;可能是另一个讨论)所以我尝试重新加载:

      1. 卷曲“http://localhost:8983/solr/admin/cores?action=RELOAD&name=tweets.tweets_test&reindex=true&deleteAll=true

      2. 获取最新架构: http://localhost:8983/solr/tweets.tweets_test/admin/file?file=schema.xml&contentType=text/xml;charset=utf-8

      3. 看不到我上传的任何更改,无论如何schema.xml都恢复原状。

        想法?