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

Catalog content is ignoring the Find Id I have given it

Vote:
 

I am indexing products and categories in Find and using an initialisation module to set the client conventions - see below.

[InitializableModule]
    [ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
    public class SearchIndexInitialization : IInitializableModule
    {
        public void Initialize(InitializationEngine context)
        {           
            ContentIndexer.Instance.Conventions.ForInstancesOf().ShouldIndex(x => false);

            SearchClient.Instance.Conventions.ForInstancesOf()
                .IdIs(x => x.Barcode)
                .IncludeField(x => x.InStock())
                .IncludeField(x => x.DisplayPrice());               

            SearchClient.Instance.Conventions.ForInstancesOf()
                .IdIs(x => x.Barcode);

            SearchClient.Instance.Conventions.ForInstancesOf()
                .IdIs(x => x.Barcode);

            SearchClient.Instance.Conventions.ForInstancesOf()
                .IdIs(x => x.Barcode);

            SearchClient.Instance.Conventions.ForInstancesOf()
                .IdIs(x => x.Code);           

        }

However, the ID field of Barcode and Code for Nodes does not seem to be used. When I run any queries the ID still looks something like this: "CatalogContent_93c105e2-8ed7-413f-b188-450cf3ad9f14_en-US"

Note that BaseProduct is the inherited type of other products and included fields do work. I added the other derived types explicitly just in case it was an inheritance issue but that seems to have no effect.

Is the standard behaviour, a bug or I missing something?

#181751
Aug 29, 2017 11:44
Vote:
 

Are these Epi Commerce products? They will be indexed automatically and you shouldn't specify any ID fields. Epi has already picked a Find identity string.

#181776
Aug 29, 2017 21:20
Vote:
 

Ahh, that's probably the issue. It looks like what Epi chooses involves a Guid i.e. CatalogContent_93c105e2-8ed7-413f-b188-450cf3ad9f14_en-US

My issue is I have an external process that does different batch updates of product data. One of the potential update is images. I wanted to be able to just update a single field on the find item. Something like this:

SearchClient.Instance.Update<MyProduct>(id).Field(x => x.ProductImages(), images);

The issue is I don't know the ID, though I would be getting the product code and barcode property in this instance.

Instead what I will have to do is

  • Perform a Search with a filter on the barcode to retrieve the item from Find
  • Update it
  • Reindex it

#181779
Aug 29, 2017 21:38
Vote:
 

The Id should be constructed in term of CatalogContent_ContentGuid_Language

So if you have the content, you can construct the id from that 

#181792
Aug 30, 2017 9:26
Vote:
 

Ahh I get it so it's using the ContentGuid property from CatalogContentBase.

Thanks @Quan Mai

#181793
Aug 30, 2017 9:38
* 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.