Copying fields

Copying fields is used when you want to interpret a field in more than one way. Solr provides a solution to copy fields so that one can apply distinct field types for the same field.

Let's see the following element that I have copied from one of the managed-schemas available in demo Solr projects:

<copyField source="name" dest="text"/>

In the previous example, we are copying the name field specified in the source attribute to a field name text, which is specified in dest.

The actual copying of fields occurs before analysis, which makes it possible to have two fields with the same content but different analyses.

The general use case of this functionality is when we have one global search for all fields. Let's say I want to search the word Harry in the title and description. Then I can create a copyField for the title and description fields and redirect them to a common destination. Look at the following snippet:

<copyField source="*_e" dest="text" maxChars="10000" />

Here, we are specifying a wildcard pattern that matches everything that ends with _e and indexes them to the destination text field.

You cannot chain copyField; that is, the destination of one copyField cannot be a part of the source of another copyField. The workaround is to create multiple destination fields and use the same source field.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.237.172