-
Notifications
You must be signed in to change notification settings - Fork 1
Configuration of the Search API module
There is extensive documentation about the configuration of the search api module. It is possible to use the search api solr module to generate the search index. This will however result in strange field names, like ss_title. This is why in catch the field names are altered. In order to do this, 2 things need to be done:
- The field names (e.g. author) need to be defined in the schema.xml of Solr.
- The field names of the Drupal node need to be mapped to the names as chosen in the schema.xml in Solr.
If you want to do the copying of different fields to the search fields (who, where etc) add the Field names in schema.xml Below, an excerpt of the catch schema.xml containing the field definitions is shown:
<!-- MuS search specific fields -->
<field name="object_number" type="string" multiValued="false" indexed="true" stored="true" required="false" />
<field name="object_name" type="text" multiValued="true" indexed="true" stored="true" required="false" />
<field name="creator" type="text" multiValued="true" indexed="true" stored="true" required="false" />
<field name="production_place" type="text" multiValued="true" indexed="true" stored="true" required="false" />
<field name="material" type="text" multiValued="true" indexed="true" stored="true" required="false" />
<field name="technique" type="text" multiValued="true" indexed="true" stored="true" required="false" />
<field name="title" type="text" multiValued="true" indexed="true" stored="true" required="false" />
<field name="production_date_start" type="text" multiValued="true" indexed="true" stored="true" required="false" />
<field name="production_date_end" type="text" multiValued="true" indexed="true" stored="true" required="false" />
<field name="production_period" type="text" multiValued="true" indexed="true" stored="true" required="false" />
<field name="inscription_date" type="text" multiValued="true" indexed="true" stored="true" required="false" />
The whole schema.xml can be found in the mussearch module.
IMPORTANT! There are 12 required fields which must be in the index! These are the fields in which will be searched, and a textual representation of these fields. The fields are:
<field name="how" type="text" multiValued="false" indexed="false" stored="true" required="false" />
<field name="what" type="text" multiValued="false" indexed="false" stored="true" required="false" />
<field name="when" type="text" multiValued="false" indexed="false" stored="true" required="false" />
<field name="where" type="text" multiValued="false" indexed="false" stored="true" required="false" />
<field name="who" type="text" multiValued="false" indexed="false" stored="true" required="false" />
<field name="raw" type="text" multiValued="false" indexed="false" stored="true" required="false" />
<!-- Fields for use with copyField-->
<field name="what_search" type="text" multiValued="true" indexed="true" stored="true" required="false" />
<field name="who_search" type="text" multiValued="true" indexed="true" stored="true" required="false" />
<field name="where_search" type="text" multiValued="true" indexed="true" stored="true" required="false" />
<field name="when_search" type="text" multiValued="true" indexed="true" stored="true" required="false" />
<field name="how_search" type="text" multiValued="true" indexed="true" stored="true" required="false" />
<field name="fulltext" type="text" multiValued="true" indexed="true" stored="true" required="false" />
Just leave these fields in the index.
Now the field names are defined in the schema.xml, the search api has to know which Solr field name corresponds to which Drupal field name. This can be done by use of the search_api_solr_field_mapping_alter hook. In catch the fieldmappings are stored in a .map file, which can be read as a php ini file.
If you don't already have the fields in which the search should be done, you can add them using the copyfield directive of solr. Is is really easy to use the copyField directive, as can be seen form the following snippet of the schema.xml:
<copyField source="title" dest="what_search" />
<copyField source="title" dest="fulltext" />
<copyField source="title_short_description" dest="what_search" />
<copyField source="title_short_description" dest="fulltext" />
<copyField source="description" dest="what_search" />
<copyField source="description" dest="fulltext" />
<copyField source="object_name" dest="what_search" />
<copyField source="object_name" dest="fulltext" />
<copyField source="creation_presentation" dest="who_search" />
<copyField source="creation_presentation" dest="fulltext" />
<copyField source="creator" dest="who_search" />
<copyField source="creator" dest="fulltext" />
<copyField source="inscription_maker" dest="who_search" />
<copyField source="inscription_maker" dest="fulltext" />
<copyField source="institution_name" dest="who_search" />
<copyField source="institution_name" dest="fulltext" />
Dit is een initiatief van Kunstmuseum Den Haag in het kader van het zgn. Catch Plus project.