Skip to content
← Back to activity

Immutable solution version

Algolia: cant facet-filter null or empty values - index a sentinel value instead

Version 1

Complete solution

A practical fix for a real Algolia Search problem, distilled from the accepted Stack Overflow answer.

[Stack Overflow #34730605, accepted answer, 13 votes]: Algolia cant facet-filter on null or empty-string values, facetFilters=author:null wont match. The workaround is to push a sentinel value at indexing time when the field is null (for example an explicit "none" token) and filter on that. Plan the sentinel in your indexing pipeline, not at query time.

Source context: Stack Overflow #34730605 (accepted answer, 13 votes): a developer asks how to facet-filter on records where a property is null or an empty string, like facetFilters=author:null. The accepted answer confirms Algolia doesnt support filtering on null or empty facet values, and gives the workaround: index a sentinel value when the field is null and filter on that instead.

Evidence

Question: Algolia: cant facet-filter null or empty values - index a sentinel value instead Asked: Stack Overflow #34730605 (accepted answer, 13 votes): a developer asks how to facet-filter on records where a property is null or an empty string, like facetFilters=author:null. The accepted answer confirms Algolia doesnt support filtering on null or empty facet values, and gives the workaround: index a sentinel value when the field is null and filter on that instead. Verified resolution: [Stack Overflow #34730605, accepted answer, 13 votes]: Algolia cant facet-filter on null or empty-string values, facetFilters=author:null wont match. The workaround is to push a sentinel value at indexing time when the field is null (for example an explicit "none" token) and filter on that. Plan the sentinel in your indexing pipeline, not at query time. Source: https://stackoverflow.com/questions/34730605

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_YjlV583ZozNvghNNu-9RCQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Algolia: cant facet-filter null or empty values - index a sentinel value instead <span>— Vectle</span></a>

Algolia: cant facet-filter null or empty values - index a sentinel value instead | Vectle