1


I have the follows configuration:

...

<field name="spellcheck" type="text_spell" indexed="true" stored="true" multiValued="true" />
<field name="spellcheck_de" type="text_spell_de" indexed="true" stored="true" multiValued="true" />
<field name="spellcheck_en" type="text_spell_en" indexed="true" stored="true" multiValued="true" />
<field name="spellcheck_fr" type="text_spell_fr" indexed="true" stored="true" multiValued="true" />
<field name="spellcheck_ja" type="text_spell" indexed="true" stored="true" multiValued="true" />
<field name="spellcheck_zh" type="text_spell" indexed="true" stored="true" multiValued="true" />
<field name="spellcheck_pt" type="text_spell_pt" indexed="true" stored="true" multiValued="true" />
<field name="spellcheck_it" type="text_spell_it" indexed="true" stored="true" multiValued="true" />
<field name="spellcheck_low" type="text_spell" indexed="true" stored="true" multiValued="true" />
<field name="spellchecksearch" type="text_spell_en" indexed="true" stored="false" multiValued="true" />

<copyField source="spellcheck_en" dest="spellcheck_low" />
<copyField source="spellcheck_low" dest="spellchecksearch" />
...

The spellcheck_en field is already populated and it comes correctly copied into spellcheck_low field and it is correctly indexing (using luke index viewer I see the index of the field not empty). However, the copy of spellcheck_low does not seem to work because spellchecksearch is empty. Note: spellcheck_en and spellcheck_low fields are both indexed and stored, while spellchecksearch is not stored but only indexed.

Why is this happening? You could clarify how a field copy works, thanks very much :)

Huntwer
  • 121
  • 2
  • 8

2 Answers2

3

copyField instructions aren't evaluated as a graph - the value that was originally submitted for the source field, is also used to populate the field given as dest.

Since there was no value submitted for the spellcheck_low field, the copyField instruction ends up copying an empty value (.. or not being executed at all).

In your case, you'll have to have two destinations for the spellcheck_en field:

<copyField source="spellcheck_en" dest="spellcheck_low" />
<copyField source="spellcheck_en" dest="spellchecksearch" />

This will be the same as you tried to implement, since any copy operation will take place before any processing or indexing happens (with the exception of update processors, IIRC).

MatsLindh
  • 49,529
  • 4
  • 53
  • 84
  • So, it happen mainly because copyField use value submitted of source field. It's right? – Huntwer Aug 07 '18 at 12:29
  • Correct. `copyField` is processed first, before the field values are sent further down the chain. And the source is what was originally submitted for the field (otherwise you could end up with looping `copyField` definitions, etc.) – MatsLindh Aug 07 '18 at 12:43
  • Now it's clear to me. Thanks very much for your help :) – Huntwer Aug 07 '18 at 21:38
2

spellchecksearch is empty because it's not stored. When a field is indexed but not stored then its only available for searching but it's value remains empty. And it doesn't get returned in the value. For details you can read- Solr index vs stored

I think if you make the field spellchecksearch indexed and stored your problem will be resolved.

Sharif Shahriar
  • 114
  • 1
  • 5