Try our conversational search powered by Generative AI!

"Bad Request" when using nested queries for facets

Vote:
 

I'm having issues getting nested queries and facets to work on my Commerce catalog content types, specifically a product content and a variation content.

I'm running Find 11.1.0.3965, Commerce 9.8.1, and CMS 9.6.1.

The issue

When I try to get results from Find, I'm getting a "(400) Bad Request" (I've tried to cut out unnecessary error data):

SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; 
...
Parse Failure [Failed to parse source 
...
"facets":{"MyNestedObjects.NestedObjectProperty":{"terms":{"field":"MyNestedObjects.NestedObjectProperty$$string"},"nested":"MyNestedObjects"},
...
Parse Failure [facet nested path [MyNestedObjects] not found]]; }

The code

Based on the documentation (http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Find/11/DotNET-Client-API/Searching/nested-queries/), I think I have everything configured and developed correctly.

This is done in an initialization module:

SearchClient.Instance.Conventions.NestedConventions.ForType().Add(content => content.MyNestedObjects);
SearchClient.Instance.Conventions.NestedConventions.ForType().Add(content => content.MyNestedObjects);

On the content types, I have the properties as such:

public IEnumerable MyNestedObjects
{
    get
    {
        var listOfNestedObjects = new List();
        ...
        return listOfNestedObjects;
    }
}

And I'm setting up the search and facets like this:

SearchClient.Instance.Search(Language.English)
    .For(someQueryText)
    .InFields(x => x.DisplayName)
    .InAllField()
    .TermsFacetFor(x => x.MyNestedObjects, x => x.NestedObjectProperty);
    .GetContentResult();

And an example of the indexed data on an instance of the content looks like:

...
"MyNestedObjects$$nested": [
{
    "$type": "MyProject.Objects.NestedObject, MyProject",
    "___types": [
        "MyProject.Objects.NestedObject",
        "System.Object"
    ],
    "NestedObjectProperty$$string": "Some Value"
}]
...

I have also tried this all as a function call on the content types, making sure to IncludeField() the function call, but the result is the same.

So everything looks to be set up correctly, right? What gives?

#148152
Edited, May 04, 2016 21:41
Vote:
 

Looks good from my point of view I'm sad to say :)

Support issue?

#148155
May 04, 2016 23:42
Vote:
 

This appears to be a bug after reproducing this in a local alloy environment with developer index. Going to submit a bug report to the Find team.

#148215
May 06, 2016 1:01
Vote:
 

Hi Chris, 

Have you raised support ticket? I am currently facing the same issue, after upgrade from EPi.Find 11.1.2.4113 to latest. The same query was working before , and now stopped working. I guess there must be some internal breaking changes that make it happen :(

Current installed version as followings

<package id="EPiServer.Find" version="11.1.5.4342" targetFramework="net46" />
<package id="EPiServer.Find.Cms" version="11.1.5.4342" targetFramework="net46" />
<package id="EPiServer.Find.Commerce" version="9.5.3" targetFramework="net46" />
<package id="EPiServer.Find.Framework" version="11.1.5.4342" targetFramework="net46" />

#148341
Edited, May 10, 2016 15:01
Vote:
 

A support ticket has been raised. I've been working with Richly to verify the issue, and the Find team is aware of the issue. It actually sounds like this issue was previously reported, so now they have two tickets. :)

A workaround has been suggested until the bug can be fixed and released, and I'm working on testing that workaround this week. If I get things working, I'll update this thread.

#148350
May 10, 2016 16:41
Vote:
 

I found the issue in my solution. 

After upgrade to the latest version, there are a few find commerce extension methods caused my query stopped working  as shown below

return query.FilterOnCurrentMarkeet()

//.FilterPriceAvailableForCurrentCurrency() ?? Internal breaking changes??
//.FilterPriceAvailableForCurrentMarket() ?? EPiFind Internal breaking changes??
.FilterForVisitor()
.FilterOnCurrentSite();

#148405
May 12, 2016 7:46
Vote:
 

code monkey: when upgrading Commerce you have to reindex the site to make the queries work (there will be a release note comming regarding this).

/Henrik

#148696
May 20, 2016 9:30
Vote:
 

Hi Henrik

That's what I did,and found out those issues.

After upgrade, I first ran reindex job and it's too slow. I then went to epi find manage, clear the index and built index from scratch, when indexing completed, my most complex query stopped working as I mentioned in my last reply. It's still broken at the moment with those two price extension methods.

Thanks,

Vincent

#148699
May 20, 2016 11:45
Vote:
 

code monkey: are you getting 'Bad Request' errors? Can you register a support case for that together with the indexname you are using?

#148744
May 23, 2016 8:37
Vote:
 

Just a follow-up to this thread... Episerver Find 12 now provides more detailed error messages. After upgrading to Find 12, I was able to see where my issue was originating (it was much deeper in the code).

#150534
Jun 21, 2016 17:00
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.