Try our conversational search powered by Generative AI!

Filter on ParentNodeRelations

Vote:
 

Hi,

I have a product that I've added to a category and then linked to another one. When querying the first category the product is found, but not when querying on the second.

When looking at the data stored in Find I see:

 "ParentNodeRelations": [
                {
                    "___types": [
                        "EPiServer.Core.ContentReference",
                    ],
                    "GetPublishedOrLatest$$bool": false,
                    "IsExternalProvider$$bool": true,
                    "$type": "EPiServer.Core.ContentReference, EPiServer",
                    "ID$$number": 1073743194,
                    "WorkID$$number": 0,
                    "ProviderName$$string": "CatalogContent"
                },
                {
                    "___types": [
                        "EPiServer.Core.ContentReference",
              
                    ],
                    "GetPublishedOrLatest$$bool": false,
                    "IsExternalProvider$$bool": true,
                    "$type": "EPiServer.Core.ContentReference, EPiServer",
                    "ID$$number": 1073743255,
                    "WorkID$$number": 0,
                    "ProviderName$$string": "CatalogContent"
                }
            ],

And I try to query this by using the following C#:
    this.SearchManager.Search().Filter(x => x.ParentNodeRelations().MatchContained(a => a.ToString(), content.ContentLink.ToString()))

The ID$$number in bold are the ID's of the original and linked categories. Unfortunatly this doesn't seem to work. The search results are empty. The COmmerce manager does display the product on both categories however.

Does anyone have an alternative solution or experience with querying linked products?

EPiServer.Find version 12.3.0 and EPiServer.Find.Commerce 9.7.0

Thanks!

/Mark

#179400
Edited, Jun 10, 2017 15:23
Vote:
 

If you type .ToString() in your query, it will actually look for a field in the index named "ToString", which it won't find. Instead, try 

(a => a.ID, content.ContentLink.ID))
#179403
Jun 12, 2017 7:32
Vote:
 

Sometimes things can be so simple... :)

thanks!

#179405
Jun 12, 2017 9: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.