# Lucene search is not returning any products with name containing special characters in it

**URL:** <https://forum.litium.com/t/lucene-search-is-not-returning-any-products-with-name-containing-special-characters-in-it/1224>\
**Category:** Questions\
**Tags:** litium-6\
**Created:** [November 26, 2019, 6:17am UTC](https://forum.litium.com/t/lucene-search-is-not-returning-any-products-with-name-containing-special-characters-in-it/1224 "2019-11-26T06:17:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sandeep](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@Sandeep](https://forum.litium.com/u/Sandeep)\
**Post date:** [November 26, 2019, 6:17am UTC](https://forum.litium.com/t/lucene-search-is-not-returning-any-products-with-name-containing-special-characters-in-it/1224/1 "2019-11-26T06:17:07Z")

</div>

Litium version: 6.0

Hi,  
We have categories and products with names containing special characters in it, few example names are

> Polyamide Light Roller with Flange PSAS —.6201(we have a autocomplete search functionality and for this name whenever i type a space after

> word Polyamide

search not returned any results back)

> Polyamide Light Roller… PAS0360 2(same with this name as well)

> U-Profile UP—.0700

> C-Skena

```
    I am using the following code to define tags 
        public static void ApplyNameAndMonitorArtcileNumberSearchTagsExactMatch(this SearchQuery searchQuery, QueryRequest request)
                {
                    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}*"));
                    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) { AllowFuzzy = false, Analyzer = "whitespace" });

      request.FilterTags.Add(textClause);
                }

```

But search service not returning any results back for the names containing special characters. I also tried with

> keyword analyzer, still not received any results back(i have applied the keyword analyser the same way we use whitespace, like

> Analyser property set to “keyword”

).

What should i do to get results back from search service for names containing special characters in it?  
I also noted from product PIM litium Backoffice, i am getting the result back for these product names

---

<div class="post-metadata">

**Author:** ![vishnu\_kj](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/vishnu_kj/32/685_2.png) [@vishnu\_kj](https://forum.litium.com/u/vishnu_kj)\
**Post date:** [November 28, 2019, 5:48am UTC](https://forum.litium.com/t/lucene-search-is-not-returning-any-products-with-name-containing-special-characters-in-it/1224/2 "2019-11-28T05:48:14Z")

</div>

```
        textClause.Tags.Add(new Tag("_name".GetFieldDefinitionForProducts()?.GetTagName(cultureInfo), $"{searchQuery.Text.Replace(" ", "\\ ")}*") { AllowFuzzy = false, Analyzer = "whitespace" });

```

Removing the whitespace with the search query will make it work like a charm

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [December 26, 2019, 5:49am UTC](https://forum.litium.com/t/lucene-search-is-not-returning-any-products-with-name-containing-special-characters-in-it/1224/3 "2019-12-26T05:49:18Z")

</div>

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