# Lucene stemming

**URL:** <https://forum.litium.com/t/lucene-stemming/948>\
**Category:** Questions\
**Created:** [June 27, 2019, 7:10am UTC](https://forum.litium.com/t/lucene-stemming/948 "2019-06-27T07:10:13Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [June 27, 2019, 7:31am UTC](https://forum.litium.com/t/lucene-stemming/948/2 "2019-06-27T07:31:45Z")

</div>

It exists multiple places you need to touch to add own analyzers into the Litium implementation.  
Analyzers is used for both indexing and searching. You need to create a reference to `Litium.Framework.Search.Lucene` NuGet package if it not already exists.

1. Configure so implementation knows about your analyzer

```auto
Litium.Framework.Search.Lucene.AnalyzerService
      .Instance
      .Factory.Analyzers
      .Add("my_analyzer", new global::Lucene.Net.Analysis.SimpleAnalyzer());

```

1. Change how data is indexed

```auto
using System;
using System.Linq;
using Litium.Foundation.Modules.ProductCatalog.Search;
using Litium.Foundation.Search.Providers;
using Litium.Framework.Search.Indexing;

namespace Litium.Accelerator.Search
{
    internal class AnalyzerProcessor : IIndexingProviderPreProcessor
    {
        public IndexDocument PreProcessDocument(IndexDocument document, string indexName)
        {
            if (ProductCatalogSearchDomains.Products.Equals(indexName, StringComparison.OrdinalIgnoreCase))
            {
                foreach (var tag in document.Tags.Where(x => x.Name.Equals("your_tag_name", StringComparison.OrdinalIgnoreCase)))
                {
                    tag.Analyzed = true;
                    tag.Analyzer = "my_analyzer";
                }
            }
            return document;
        }
    }
}

```

1. [Searching](https://docs.litium.com/documentation/architecture/search/analyzers)  
`request.FilterTags.Add(new Tag("your_tag_name", "value") { Analyzer = "my_analyzer" });`

---

_[View the full topic](https://forum.litium.com/t/lucene-stemming/948)._
