Lucene Search returns 0 for TextOption field

Hi, and thanks in advance.

I’m trying to use Lucene search using the ProductSearchService in Litium Accelerator.
The search works as expected in most areas but when I try to filter on a TextOption where the value for example is ‘W’ and resides on the Base product i get 0 hits.

Using the exact same method but on a Text field but in this case on the variant it works as expected.

I tried rebuilding the Index. I tried to see if i can read the index to see if the value is stored but seems that Luke is not compatible? Any ideas?

Litium version: 7.2.3

TextOption should work regardless the entity level they’re on, compare Brand vs Color in a standard Accelerator.

How do you add the filter tag? Have you tried just adding that tag to rule out any other tag interfering?

Pretty much as the default code found in SearchQueryBuilder and from docs.
Works for every other field but this TextOption

From what I can see maybe the cultureinfo is the issue since the only thing that differs other than field type is that it’s using culture but that is only for the name not the actual value.

So Dictionary key will be “FieldId” and tags the value “W”

 public void ApplyProductFilters(IDictionary<string, ISet<string>> tags)
     if (tags == null) return;

     var cultureInfo = new Guid(_request.LanguageId).GetLanguage()?.CultureInfo;
     foreach (var tag in tags.Where(x => x.Value.Count > 0))
         var field = tag.Key.GetFieldDefinitionForProducts();
         var tagName = field?.GetTagName(cultureInfo) ?? tag.Key;
         if (tag.Value.Count > 1)
             var optionalTags = new OptionalTagClause();
             foreach (var tagValue in tag.Value)
             _request.FilterTags.Add(GetTag(field, tag.Value.First()));

GetTag(.....) => new Tag(field.GetTagName(), value)

Update after testing some more it seems that it gets hit on Name but not Value

TextOption Name Winter, Value W
I get hit on Winter but not on the actual Value W

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.