Problem
The current "best practice" for facet conditions that are calculated fields (such as a vocabulary or a value from a referenced object) is to create a Zope indexer and use the indexed value as a Solr index.
However, when the referenced object might update, this approach won't be able to follow changes in the referenced object. To solve this with the indexer approach, the referrer content type would need to be reindexed triggered by any change in the referred object.
Proposed Solution
In cases where reindexing on reference changes is not desirable, we prefer an alternative approach:
- Use vocabulary keys as the index value
- Resolve human-readable labels by applying a dictionary lookup on the client side
Vocabulary definitions approach
- Vocabulary-to-field mappings will be defined in the
kitconcept.solr.interfaces.IKitconceptSolrSettings.xml registry
- The service response will include metadata indicating which vocabulary to use for which field, instructing the client
This follows the same pattern as content type facets: the backend is the single source of truth for configuration.
Benefits
- Avoids cascading reindex operations when referenced objects change
- Simpler data model with stable keys in the index
- Multilingual support potential through multilingual vocabulary lookups (not a current requirement, but enables future development)
Trade-offs
The indexer approach still provides the fastest search results when cascading reindexes are acceptable (as it does not require calling the vocabulary endpoint). This feature provides an alternative when that trade-off is not desirable.
Implementation Plan
Problem
The current "best practice" for facet conditions that are calculated fields (such as a vocabulary or a value from a referenced object) is to create a Zope indexer and use the indexed value as a Solr index.
However, when the referenced object might update, this approach won't be able to follow changes in the referenced object. To solve this with the indexer approach, the referrer content type would need to be reindexed triggered by any change in the referred object.
Proposed Solution
In cases where reindexing on reference changes is not desirable, we prefer an alternative approach:
Vocabulary definitions approach
kitconcept.solr.interfaces.IKitconceptSolrSettings.xmlregistryThis follows the same pattern as content type facets: the backend is the single source of truth for configuration.
Benefits
Trade-offs
The indexer approach still provides the fastest search results when cascading reindexes are acceptable (as it does not require calling the vocabulary endpoint). This feature provides an alternative when that trade-off is not desirable.
Implementation Plan