Try our conversational search powered by Generative AI!

K Khan
Sep 15, 2015
  4245
(5 votes)

EPiServer Find performance review

EPiServer Find is a product for free text search as well as content retrieval. It offers an intuitive API for indexing and querying objects. It allows to query data using our own domain model as it recognizes the fact that we know best about our data. It offers a better experience to users, shorter development cycles and cost efficiency.

EPiserver Find Search performance and capabilities are proven but how developers are using those can affect the site performance. If developers are writing queries that involves round trips can effect the performance of page.

//Not optimal
foreach (var article in Articles)
{
      var results = SearchClient.Instance.Search<ArticlePage>()
                                                        .For(article).GetResult();
}
//Optimal
results = service.MultiSearch<ArticlePage>()
                            .Search<Article>(x => x.For("Article1").InField(y => y.Title))
                            .Search<Article>(x => x.For("Article2").InField(y => y.Title))
                            .GetResult();

Indexing data to EPiserver find is a time consuming task and needs consideration when implementing. We need to consider batch size and objects also. EPiserver Find indexing like Bulks.

// Not optimal 
List<MyObject> objects = GetObjectsFromSomeWhere();
foreach (var o in objects)
{
    client.Index(o);
}
// Optimal 
List<MyObject> objects = GetObjectsFromSomeWhere();
client.Index(objects);

By doing this, we will significantly reduce the number of calls sent to the Find index, thus increase the general performance and decrease time taken to index. 

While indexing we have to consider object sizes also. If object size are too large we have to reduce the no of items to go in one index pack. There are few other factors that developers must consider while indexing the data are as following

  • Dont Index the unwanted objects e.g. Images/Videos
    ContentIndexer.Instance.Conventions.ForInstancesOf<ImageData>().ShouldIndex(x => false);
  • Implement the BatchSize for indexing so it can be adjusted to improve indexing time.
    // set the ContentBatchSize to confingured value 
    ContentIndexer.Instance.ContentBatchSize = contentBatchSize;
    
    // set the MediaBatchSize to confingured value
    ContentIndexer.Instance.MediaBatchSize = mediaBatchSize;
    

It will be helpful, if you could share performance issue that you have faced and their fixes also in comments. 

Sep 15, 2015

Comments

Henrik Fransas
Henrik Fransas Sep 15, 2015 12:29 PM

Great post!

Also remenber to cache the the result if you are using GetResult (GetContentResult do it automaticly) like this:

var result = client.Search()
    .StaticallyCacheFor(TimeSpan.FromMinutes(5))
    .GetResult();

And also a great way to improve performance is to use projections instead of returning the whole object, if you for example only are interested in title and author name you can do like this to project it into a anonymous type:

var result = client.Search()
    .Select(x => new { 
        x.Title, 
        AuthorName = x.Author.Name })
    .GetResult();

Or like this to project it into a type'ed object:

var result = client.Search()
    .Select(x => new SearchResult { 
        Title = x.Title.AsCropped(50), 
        Author = x.Author.Name})
    .GetResult();

K Khan
K Khan Sep 15, 2015 02:47 PM

great addition :)

Per Magne Skuseth
Per Magne Skuseth Sep 25, 2015 09:14 AM

Thanks for sharing!
Regarding bulk indexing, check out this blog post for a handy snippet

Please login to comment.
Latest blogs
Optimizely and the never-ending story of the missing globe!

I've worked with Optimizely CMS for 14 years, and there are two things I'm obsessed with: Link validation and the globe that keeps disappearing on...

Tomas Hensrud Gulla | Apr 18, 2024 | Syndicated blog

Visitor Groups Usage Report For Optimizely CMS 12

This add-on offers detailed information on how visitor groups are used and how effective they are within Optimizely CMS. Editors can monitor and...

Adnan Zameer | Apr 18, 2024 | Syndicated blog

Azure AI Language – Abstractive Summarisation in Optimizely CMS

In this article, I show how the abstraction summarisation feature provided by the Azure AI Language platform, can be used within Optimizely CMS to...

Anil Patel | Apr 18, 2024 | Syndicated blog

Fix your Search & Navigation (Find) indexing job, please

Once upon a time, a colleague asked me to look into a customer database with weird spikes in database log usage. (You might start to wonder why I a...

Quan Mai | Apr 17, 2024 | Syndicated blog

The A/A Test: What You Need to Know

Sure, we all know what an A/B test can do. But what is an A/A test? How is it different? With an A/B test, we know that we can take a webpage (our...

Lindsey Rogers | Apr 15, 2024

.Net Core Timezone ID's Windows vs Linux

Hey all, First post here and I would like to talk about Timezone ID's and How Windows and Linux systems use different IDs. We currently run a .NET...

sheider | Apr 15, 2024