找到你要的答案

Q:Solr splitBy has no affect

Q:Solr splitby没有影响

I want to index a DB field to multi valued field.

data-config.xml:

<entity name="car_type" transformer="ClobTransformer" query="select car_data from cars">
<field column="CAR_DATA"  splitBy="\$" clob="true"/>

schema.xml:

<field name="CAR_DATA" type="text_general" indexed="true" stored="true" multiValued="true"/>
 <fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
  <analyzer type="index">
            <tokenizer class="solr.PatternTokenizerFactory" pattern="[\.|\s|\-|\~]"/>
    <!--<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" /> -->
    <!-- in this example, we will only use synonyms at query time
    <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
    -->
    <filter class="solr.LowerCaseFilterFactory"/>

  </analyzer>
  <analyzer type="query">
            <tokenizer class="solr.PatternTokenizerFactory" pattern="[\.|\s|\-]"/>
    <!--<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>

the spiltBy has no affect and I get the value as is, But I expect to get list of values.

我想将一个DB字段索引到多值字段。

data-config.xml:

<entity name="car_type" transformer="ClobTransformer" query="select car_data from cars">
<field column="CAR_DATA"  splitBy="\$" clob="true"/>

SCHEMA.XML:

<field name="CAR_DATA" type="text_general" indexed="true" stored="true" multiValued="true"/>
 <fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
  <analyzer type="index">
            <tokenizer class="solr.PatternTokenizerFactory" pattern="[\.|\s|\-|\~]"/>
    <!--<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" /> -->
    <!-- in this example, we will only use synonyms at query time
    <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
    -->
    <filter class="solr.LowerCaseFilterFactory"/>

  </analyzer>
  <analyzer type="query">
            <tokenizer class="solr.PatternTokenizerFactory" pattern="[\.|\s|\-]"/>
    <!--<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>

的spiltby没有影响我的价值,但我期望得到的值列表。

answer1: 回答1:

You need to add RegexTransformer. try this:

<entity name="car_type" transformer="ClobTransformer,RegexTransformer" query="select car_data from cars">

You need to add RegexTransformer. try this:

<entity name="car_type" transformer="ClobTransformer,RegexTransformer" query="select car_data from cars">
solr