Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

EpiServer.Find.IClient Search sometimes returns no blocks and other times returns blocks that have been deleted

Vote:
 

I'm using the search like this:

var results = client.Search<GolfDigestGalleryBlock>().FilterForVisitor().Take(MAXRESULTS);

It's behaving very inconsistently. I've set up a new page that uses this service and i'm getting no blocks returned. But I have an existing page that I've deleted blocks from and those blocks are still coming back. Amd I using this wrong?

#300128
Apr 14, 2023 17:16
Vote:
 

How many blocks does this method return and how often do you run it? If you harass Find to much it won't return any results for a while.

Anyway, to start with you should ensure that pages in your recycle bin isn't indexed. If you still do, you can handle this by adding .ExcludeDeleted() to your query. You should also add some caching to your resonspe.

client.Search<BlockData>()
    .FilterForVisitor()
    .ExcludeDeleted()
    .StaticallyCacheFor(TimeSpan.FromSeconds(60))
    .Take(NOTMORETHANYOUNEED)
#300235
Apr 17, 2023 7:41
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.