Try our conversational search powered by Generative AI!

Change how id is set?



Is there a way to change how Find is setting the id on the IndexDocument?

Id has no setter, but there is a id convention, but not sure how to use it...


If I look in the source code for the PageIndexer class the use of page.GetIndexId() seems to be hardcoded.


Why? Stupid decision, we made a copy of a website's database because the should basically have the same content from the start, and now they want to share the same index. So the guids are no longer unique. We want to add the site id to the document id so it gets unique again.

Apr 16, 2013 11:12

SearchClient.Instance.Conventions.ForInstancesOf<PageData>().IdIs(x => ...) should change what the ID is. However, there may be places in the CMS integration that relies on the default ID strategy for pages. Hopefully Henrik och Marcus can check that.

Apr 16, 2013 12:48

Seems to work. Thanks.

page.GetIndexId() is used in the Delete method in PageIndexer, so yes, there will probably be some problems...

Apr 16, 2013 15:00

Should maybe clarify that we're using EPi6 and EPiServer.Find.Cms

Apr 16, 2013 15:01


You could change the Id-convention by calling:

SearchClient.Instance.Conventions.ForInstancesOf<PageData>().IdIs(x => x.MyIdExtension());

However I see that there is a bug as you have noticed in the PageIndexer when deleting a document, overruling the conventions by calling GetIndexId() directly. If you contact the support they will provide you with a patch.

Apr 17, 2013 8:09
Apr 17, 2013 10:43
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.