Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info

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:

...

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 ca exclude 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:

Code Block
- 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).

Code Block
- id: drop-values
  params:
    fields:
      constant: category
  condition: fields.category = ['']