Change how id is set?

Member since: 2007

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
  • 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
  • Member since: 2007

    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
  • Member since: 2007

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

    #70280 Apr 16, 2013 15:01
  • 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
  • #70323 Removed, Apr 17, 2013 10:43