apachesolrcustom-field-type

Apache solr : Put Multiple Field values together


I want to group on multiple fields(5 fields). In solr for that I dont know what to do!. But I got Idea that if I merge all my five fields together as single field value with delimnator char is "~". then if I group on that field, I can get result.

But for this merging all fields together what I have to do, anyone plz?


Solution

  • In order to group by multiple fields, this is probably the easiest way to do, but it requires that you have a static group clause i.e. the fields for grouping are pre-determined.

    In order to do this, you need to create a new field in your schema.xml and map it to a concatenated value of the fields at the time of indexing.

    If you are using DataImportHandler, you could use the ScriptTransformer to compute this field's value.