Jayadevan
Jayadevan

Reputation: 1342

How to use Solr copy field

I am a newbie to Solr world and trying to figure out how copy field works. In the managed-schema, there is one field that is copied from multiple source fields. I made a new field that is similar to the existing one and reloaded the collection, also tried restarting Solr. But the new field is not visible when I query via Solr Admin. The relevant lines are as follows:

<fieldType class="solr.TextField" name="text_suggest" positionIncrementGap="100">
        <analyzer>
            <tokenizer class="solr.StandardTokenizerFactory"/>
            <filter class="solr.StandardFilterFactory"/>
            <filter class="solr.LowerCaseFilterFactory"/>
        </analyzer>
</fieldType>


<field name="newdescription" type="text_suggest" indexed="true" stored="true" multiValued="true" />

<copyField source="name" dest="newdescription"/>
<copyField source="Brand" dest="newdescription"/>
<copyField source="category" dest="newdescription"/>
<copyField source="product_group" dest="newdescription"/>

The existing field which does get displayed has a different name, but everything else is the same as the above code. Solr collection gets populated from a Mongo collection. I didn't execute the dataimport job, since I assume copyfields will get populated when I reindex/reload the collection. Solr version is 7.3

Upvotes: 0

Views: 1725

Answers (1)

Jeeppp
Jeeppp

Reputation: 1573

I assume that you have just reloaded the collection and you are expecting the copy fields to be generated.

Copy field doesn't work that way, copying is done at the stream source level and hence you need to run your data import job after reloading/restarting the collection.

"I assume copyfields will get populated when I reindex/reload the collection". Reindex and Reload are two different stuff.

Upvotes: 1

Related Questions