Litium lucene search with exact name is failing for few product name with special characters

Hi,

Litium version: 6

I was trying to implement lucene search with exact match of text with product fields and seen search with few product names with special characters returning 0 hits(example name: Polyamide Light Roller with Flange PSAS ---.6200). I have noticed issue is coming only for products with name having special characters.

Is there any issue with lucene search with products having names with special characters?

I am using below optional tag clause to filter my products back and below is the code used

var text = searchQuery.Text;
            if (string.IsNullOrEmpty(text))
            {
                return;
            }
            var cultureInfo = new Guid(request.LanguageId).GetLanguage()?.CultureInfo;
            var textClause = new OptionalTagClause();
            
            textClause.Tags.Add(new Tag("_name".GetFieldDefinitionForProducts()?.GetTagName(cultureInfo), searchQuery.Text) { AllowFuzzy = true });
            textClause.Tags.Add(new Tag("_name".GetFieldDefinitionForProducts()?.GetTagName(cultureInfo), searchQuery.Text + "*"));
            textClause.Tags.Add(new Tag("_name".GetFieldDefinitionForProducts()?.GetTagName(cultureInfo), "*" + searchQuery.Text));
            textClause.Tags.Add(new Tag("_name".GetFieldDefinitionForProducts()?.GetTagName(cultureInfo), "*" + searchQuery.Text + "*"));
            textClause.Tags.Add(new Tag("_name".GetFieldDefinitionForProducts()?.GetTagName(cultureInfo), searchQuery.Text));

            textClause.Tags.Add(new Tag("MonitorArticleNumber".GetFieldDefinitionForProducts()?.GetTagName(cultureInfo), searchQuery.Text) { AllowFuzzy = true });
            textClause.Tags.Add(new Tag("MonitorArticleNumber".GetFieldDefinitionForProducts()?.GetTagName(cultureInfo), searchQuery.Text));
            
            request.FilterTags.Add(textClause);

Am i doing anything wrong in my codes?

Have you tried using a different analyzer? Perhaps Whitespace?
https://docs.litium.com/documentation/previous-versions/litium-6/architecture/search/analyzers

The standard analyzer treats dashes and full stops as white space.

Hi Nils, Thanks for your time,
The documentation link helped me to learn more about lucene search.

I changed the Analyzer property from

> standard

to

> whitespace, but no luck, still search returned 0 hits, and thinking might be number of special character is more in my case(hyphon, fullstop and white space) and that failing the search. Is there any way i can tell the search so that it will accept more than one special character?

Try to use the keyword analyzer. It can be that you need to modify the analyzer also for indexing that is using the standard analyzer.

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