This Confluence instance is now read-only, please head over to the Algolia Confluence instance for the same more up-to-date information
How to drop a field with an empty value
This is an Indexing pipeline step
You might find that some empty data has been stored in your index. For example, if you have a website collection with some custom metadata stored on some pages:
<meta name="primary-topic" data-sj-field="category" content="Kids,Books,Fiction">
But which is empty on other pages:
<meta name="primary-topic" data-sj-field="category">
This data will still be stored in the index as so:
If you are building a search interface using category
as a facet, you will find there is empty string in the faceting.
To get around this, we can exclude the field from indexing if it is empty.
To do so navigate to Indexing > Advanced and paste the following step into the YAML file:
- id: drop-values
params:
fields:
constant: category
condition: fields.category = ''
The drop-values
step does as the name suggests - it drops the values! In this case we are saying to the indexing engine to drop the values for category if the field is empty.
To achieve the same for an array field, you can do the following (note the use of brackets []
in the condition).