0
votes

I'm working with Solr5.2.1 and want to index my variable(link) into two different values(original link, core link)

for example, if there is a input http://wiki.apache.org/solr/ then, original link is http://wiki.apache.org/solr/ itself, and core link is wiki.apache.org

my current Solr indexs core link but not for original link. please help me to my solr configuration works well with indexing original link

in my schema.xml, link is defined as below, and uses "text_general".

<field name="link" type="text_general" indexed="true" stored="true" required="false" />

<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100" multiValued="true">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />

To get the original link, should I use multiValued="true"?

3

3 Answers

0
votes

You can have another field for core link and then a document of solr will have core link and original link.

I would suggest not to add it as in same field by making multivalued true.

In future if you want to link original and core separate, then separate field would work for you.

But yes there is no harm in adding it to same field if you don't want to carry any separate search or analysis.

0
votes

You should not use Standard Tokenizer as mentioned in your schema.xml because it treats '/' as delimiter. Instead of it, you should use Keyword Tokenizer as shown,

<analyzer type="index">
<tokenizer class="solr.KeywordTokenizerFactory"/>

And Multivalued fields allows us to store more than one value in the same field. So there is no use of using multiValued="true".

0
votes

You should enable your link field to accept multiple values

Yes try with multiValued="true" for field name "link" since you want to index both link string values into same field. And with StandardTokenizer your original link will be split. here it consider the character "/" as delimiter. here your original link http://wiki.apache.org/solr/ it will become tokens as

http

wiki.apache.org

Solr