How do I add a filter tag for a ‘unset’ boolean?
I do not want to force the client to add a value to each variant or even the base product.
var optional = new OptionalTagClause(new[]
{
new Tag(BooleanProperties.DoNotShowInDropdown.GetTagName(), false),
new Tag(BooleanProperties.DoNotShowInDropdown.GetTagName(), (bool?) null)
});
Just new Tag(BooleanProperties.DoNotShowInDropdown.GetTagName(), false) does not seem to work.
Litium version: 5.6.4
Setting a default true value on the base product seems to overwrite the false setting on the variant?
- And yes I have rebuilt the search index.
It is not possible to check for non-values in Lucene, You must set/init the value to something in order to be search indexed.
Ok. How ever.
Setting a default true value on the base product seems to overwrite the false setting on the variant?
- And yes I have rebuilt the search index.
Indexing depends on if the variants are product-based-url or variant-based-url, and if the variant is product-based-url then it will be overwritten.
I know that. And the setting is variant-based-url. Which makes the behavior wierd.
Search index is using all field from the base product and the variant so if you set false
on base product and true
on the variant the search index will contains both false
and true
.
If you index with base products url the search index will conatins the fields from the base product and all the variants for the base product.
If you want only one of the values to be indexed you need to implement an own IIndexingProviderPreProcessor
that will manipulate the indexing document to not store both of the values. MostSoldIndexingProviderPreProcessor
in accelerator is one example how you can implement an IIndexingProviderPreProcessor
that will modify the search document index.