November Happy Hour will be moved to Thursday December 5th.

Change how id is set?

Vote:
 

Hi,


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...

SearchClient.Instance.Conventions.IdConvention.GetId(object)

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.

#70259
Apr 16, 2013 11:12
Vote:
 

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.

#70268
Apr 16, 2013 12:48
Vote:
 

Seems to work. Thanks.

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

#70278
Apr 16, 2013 15:00
Vote:
 

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

#70280
Apr 16, 2013 15:01
Vote:
 

Hi,

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.

#70312
Apr 17, 2013 8:09
Vote:
 
#70323
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.