Field Mappings: Send Your Own Fields

Post meta, taxonomies and attributes as searchable fields

Field Mappings send your own WordPress data to your Opensolr Index: a brand stored in post meta, an ACF field, a taxonomy, a WooCommerce attribute. Once a field is in the index, you can turn it into a filter of your search page. The section is at the top of the Facet Mapping tab.

Add a mapping

  1. Open Settings > Opensolr Search, tab Facet Mapping.
  2. In WordPress Field, start typing: the list offers the post fields (post_title, post_date and the others), the meta keys of your posts (also the ones starting with an underscore, such as _price), the public taxonomies and, with WooCommerce, the product attributes (pa_...), featured_image_url and gallery_image_urls.
  3. In Solr Field Name, give the field a short name, for example brand.
  4. Pick the Solr Type. The plugin pre-selects the type that fits the values it found.
  5. Give it a Display Label, for example "Brand".
  6. Click + Add Field Mapping for more rows, then Save Facet Settings.
  7. Crawl or ingest your content again, so the new field reaches the index.

The types

The field in your index is the name plus the ending of its type: brand with String (single) becomes brand_s.

  • String (single) _s, the default, and String (multi-value) _sm. String (single, legacy) _ss is there for older setups.
  • Float (single) _f and Float (multi-value) _fm, for prices and measures.
  • Integer (single) _i and Integer (multi-value) _im, for counts and lengths in seconds.
  • Date (single) _dt and Date (multi-value) _dtm.

Pick a multi-value type when a post can have several values, such as several tags or colours. What these endings mean in your index: Dynamic fields.

How the values reach your index

  • Crawl: the plugin writes each value in the page head as a tag named opensolr: plus the field, for example opensolr:brand_s. The Data Crawler reads it. A multi-value field gets one tag per value.
  • Push: Data Ingestion sends the value with the post.

A media ID becomes the address of the file, and an ACF image or file field sends its address.

Then use it

Once the field holds values in your index, it appears in the table below the mappings: Facet Configuration. It can also be the source of result pictures: Solr field for result image.

Facets