|
ticket related https://support.optimizely.com/hc/en-us/requests/793647
Hi,
I have the same issue but using Search and not MultiSearch query. Here is the code:
var query = _client.Search<WebProductCard>()
.For(q).WithAndAsDefaultOperator()
.InField(d => d.DisplayName, _startPage?.FindSearchRelevance?.DisplayNameRelevance ?? 0)
.AndInField(d => d.Brand, _startPage?.FindSearchRelevance?.BrandRelevance ?? 0)
.AndInField(d => d.ItemNumbers, _startPage?.FindSearchRelevance?.ItemNumbersRelevance ?? 0)
.AndInField(d => d.SubCategory, _startPage?.FindSearchRelevance?.SubcategoryRelevance ?? 0)
.AndInField(d => d.ColorNames, _startPage?.FindSearchRelevance?.ColorRelevance ?? 0)
.AndInField(d => d.Description, _startPage?.FindSearchRelevance?.DescriptionRelevance ?? 0)
.AndInField(d => d.AttributeGroup, _startPage?.FindSearchRelevance?.AttributeGroupRelevance ?? 0)
.UsingPersonalization()
.UsingSynonyms()
.ApplyBestBets()
.Track()
.BoostMatching(x => x.InStock.Match(true), _startPage?.FindSearchBoost?.StockBoost ?? 0)
.BoostMatching(x => x.SpecialOffer.Match("true"), _startPage?.FindSearchBoost?.PromotionBoost ?? 0)
.BoostMatching(x => x.HasSample.Match(true), _startPage?.FindSearchBoost?.SampleBoost ?? 0)
.BoostMatchingBoostList(boostedProducts)
.FilterLangauge()
.Include(d => d.DisplayName.AnyWordBeginsWith(q))
.Include(d => d.Brand.AnyWordBeginsWith(q))
.FuzzyFilter(d => d.DisplayName, q)
.FuzzyFilter(d => d.Brand, q)
.FilterOnCurrentSite()
.Select(x => new WebProductProjectionModel
{
Code = x.Code,
DisplayName = !string.IsNullOrEmpty(x.DisplayName.AsHighlighted()) ? x.DisplayName.AsHighlighted(new HighlightSpec
{
PreTag = "<b>",
PostTag = "</b>",
NumberOfFragments = 1,
FragmentSize = 200,
}) : x.DisplayName,
ContentLink = x.ContentLink,
ListPrice = x.NowPrice,
Url = x.Url,
Image = x.ImageUrl,
IsBuyableFromList = !x.HasVariants
}).Take(5);
var result = query.StaticallyCacheFor(_cacheTime).GetResult();
return result.Hits;
It is throwing an error sometimes and I don't have a clue on what's the trigger. Here is the nested json below.
{
"size": 5,
"query": {
"filtered": {
"query": {
"filtered": {
"query": {
"bool": {
"should": [
{
"bool": {
"should": [
{
"bool": {
"should": [
{
"bool": {
"should": [
{
"filtered": {
"query": {
"custom_filters_score": {
"query": {
"function_score": {
"query": {
"bool": {
"should": [
{
"query_string": {
"fields": [
"DisplayName$$string.standard^100",
"Brand$$string.standard^10",
"ItemNumbers.standard^5",
"SubCategory$$string.standard^5",
"ColorNames$$string.standard^5",
"Description$$string.standard^1",
"AttributeGroup$$string.standard^10"
],
"query": "Carpet",
"analyzer": "standard",
"default_operator": "AND"
}
},
{
"constant_score": {
"filter": {
"or": [
{
"ids": null
}
]
}
}
}
]
}
}
}
}
}
}
}
}
]
}
}
]
}
}
]
}
}
]
}
}
}
}
}
}
}
Hi all, i'm troubleshooting an scenario that happens only when I'm looking for straight numbers (treated always as strings).
Looks like my searh elements are getting nested somehow and when try to have the json query, I'm getting EPiServer.Find.MaxSerializationDepthExceededException
The following query is being created as per the next code.
here is the big nested json as result, the one who raises the expection above.
It only happens with certain numeric codes, not with non existen words or numbers or anything else.