November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
// Generated by .NET Reflector from C:\Projects\xxx\lib\EPiServer.Commerce.FindSearchProvider.8.12.0\lib\net45\EPiServer.Commerce.FindSearchProvider.dll namespace EPiServer.Commerce.FindSearchProvider { using EPiServer.Commerce.FindSearchProvider.LocalImplementation; using EPiServer.Find; using EPiServer.Globalization; using Mediachase.Commerce; using Mediachase.Search; using Mediachase.Search.Extensions; using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Linq; using System.Runtime.CompilerServices; public class FindSearchQueryBuilder : ISearchQueryBuilder { private static readonly Dictionary<string, Language> _providerLanguages = Language.GetAll().ToDictionary<Language, string>(l => l.get_FieldSuffix(), LanguageComparer.Instance); public FindSearchQueryBuilder(IClient client, ISearchCriteria criteria) { ITypeSearch<FindDocument> search; ProviderClient client2 = client as ProviderClient; if (client2 == null) { throw new InvalidOperationException("The Find search query builder only works with clients created by the provider."); } ISearchConfiguration providerConfiguration = client2.ProviderConfiguration; Language language = null; if (!criteria.get_IgnoreFilterOnLanguage() && _providerLanguages.TryGetValue(criteria.get_Locale(), out language)) { search = client2.Search<FindDocument>(language); } else { search = client2.Search<FindDocument>(); } CatalogEntrySearchCriteria criteria2 = criteria as CatalogEntrySearchCriteria; if (criteria2 != null) { if (criteria.get_IgnoreFilterOnLanguage()) { search = search.ForDefaultFields(criteria2.get_SearchPhrase(), string.Empty); } else { search = search.ForDefaultFields(criteria2.get_SearchPhrase(), criteria.get_Locale()); string str = string.IsNullOrEmpty(language.get_FieldSuffix()) ? ContentLanguage.get_PreferredCulture().Name : language.get_FieldSuffix(); search = search.FilterLanguages(str); } if ((DateTime.MinValue < criteria2.get_StartDate()) && (criteria2.get_EndDate() < DateTime.MaxValue)) { search = search.FilterDates(criteria2.get_StartDate(), criteria2.get_EndDate(), criteria2.get_IncludePreorderEntry()); } search = search.FilterCatalogs(this.ToStringEnumerable(criteria2.get_CatalogNames())).FilterCatalogNodes(this.GetNodes(criteria2)).FilterOutlines(this.GetOutlines(criteria2)).FilterMetaClasses(this.ToStringEnumerable(criteria2.get_SearchIndex())).FilterCatalogEntryTypes(this.ToStringEnumerable(criteria2.get_ClassTypes())); if (!criteria2.get_IncludeInactive()) { search = search.FilterInactiveCatalogEntries(); } if (criteria2.get_MarketId() != MarketId.Empty) { search = search.FilterCatalogEntryMarket(criteria2.get_MarketId()); } } search = search.AddActiveFilters(criteria).AddFacets(criteria).OrderBy(criteria); if (criteria.get_StartingRecord() > 0) { search = SearchExtensions.Skip<FindDocument>(search, criteria.get_StartingRecord()); } if (criteria.get_RecordsToRetrieve() > 0) { search = SearchExtensions.Take<FindDocument>(search, criteria.get_RecordsToRetrieve()); } this.Search = search; }
Problem seems to be that EPiServer.Find.GetAll() returns languages with two letters like for example: 'no' among 33 or so others
CMS is configured to use only 'nb-NO'
so in EPiServer.Commerce.FindSearchProvider.FindSearchQueryBuilder(see image below):
As a temporary workaround I have modified:
<%@ Import Namespace="System.Reflection" %> <%@ Import Namespace="EPiServer.Find" %> <script runat="server"> protected void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); var type = typeof(Language); var field = type.GetField("_allLanguages", BindingFlags.Static | BindingFlags.NonPublic); if (field == null) { throw new NotImplementedException("_allLanguages must not be null"); } var allLanguages = Language.GetAll().ToList(); if (allLanguages.All(x => x.FieldSuffix != "nb-NO")) { allLanguages.Add(new Language("Norwegian", "norwegian", "nb-NO", "norwegian", "norwegian_synonym")); field.SetValue(null, allLanguages); } } </script>
to add 'nb-NO' to EPiServer.Find.Language class using reflection and that solves problem and epi.find search works in manager,
question is am I doing something wrong or this is bug of either or multiple ones of these:
But all our content and products are under 'nb-NO' and we dont want to migrate that(probably would not be easy as well)
So yes, please fix it.
I'm not a Find expert, but from what I understand when you come to Find, it'll index by main language only, not culture specific. So even your language is nb-NO, it will index as "no" - so I don't think it really makes sense when you search here.
Regards,
/Q
No, it indexes 'nb-NO' and not 'no'
Becasue even without this fix, search from CMS Commerce UI works(//<site>/cms/Commerce/Catalog), its done correct there.
And indexed FindDocument items have:
"Languages": [ "nb-no" ],
most likely because commerce data is saved as 'nb-NO'
It works in Catalog UI from any locale, becasue it(locale) is not sent over wire to epi.find.
CatalogUI does not specify language at all, while manager provides that feature and fails with 'nb-NO' unless EPiServer.Find.GetAll() is forced to return 'nb-NO'
CatalogUI example:
POST http://es-eu-dev-api01.episerver.net/xxxx/YYYY/_search HTTP/1.1 Content-Type: application/json User-Agent: EPiServer-Find-NET-API/11.1.1.4013 Host: es-eu-dev-api01.episerver.net Content-Length: 999 Expect: 100-continue Accept-Encoding: gzip, deflate Connection: Keep-Alive { "size":10, "query":{ "filtered":{ "query":{ "filtered":{ "query":{ "query_string":{ "query":"77777777" } }, "filter":{ "and":[ { "or":[ { "range":{ "StartDate$$date":{ "from":"0001-01-01T00:00:00Z", "to":"9999-12-31T21:59:59.9999999Z", "include_lower":true, "include_upper":false } } }, { "term":{ "StartDate$$date":"9999-12-31T21:59:59.9999999Z" } }, { "and":[ { "term":{ "AllowPreorder$$bool":true } }, { "or":[ { "range":{ "PreorderAvailableDate$$date":{ "from":"0001-01-01T00:00:00Z", "to":"9999-12-31T21:59:59.9999999Z", "include_lower":true, "include_upper":false } } }, { "term":{ "PreorderAvailableDate$$date":"9999-12-31T21:59:59.9999999Z" } } ] } ] } ] }, { "or":[ { "range":{ "EndDate$$date":{ "from":"0001-01-01T00:00:00Z", "to":"9999-12-31T21:59:59.9999999Z", "include_lower":false, "include_upper":true } } }, { "term":{ "EndDate$$date":"0001-01-01T00:00:00Z" } } ] }, { "or":[ { "term":{ "Catalogs.lowercase":"nettbutikk" } }, { "term":{ "Catalogs.lowercase":"produktkatalog" } } ] } ] } } }, "filter":{ "term":{ "___types":"EPiServer.Commerce.FindSearchProvider.FindDocument" } } } } }
manager example:
POST http://es-eu-dev-api01.episerver.net/xxxx/YYYY/_search HTTP/1.1 Content-Type: application/json User-Agent: EPiServer-Find-NET-API/11.1.1.4013 Host: es-eu-dev-api01.episerver.net Content-Length: 956 Expect: 100-continue Accept-Encoding: gzip, deflate { "size":20, "query":{ "filtered":{ "query":{ "constant_score":{ "filter":{ "and":[ { "term":{ "Languages.lowercase":"nb-no" } }, { "or":[ { "range":{ "StartDate$$date":{ "from":"0001-01-01T00:00:00Z", "to":"9999-12-31T21:59:59.9999999Z", "include_lower":true, "include_upper":false } } }, { "term":{ "StartDate$$date":"9999-12-31T21:59:59.9999999Z" } }, { "and":[ { "term":{ "AllowPreorder$$bool":true } }, { "or":[ { "range":{ "PreorderAvailableDate$$date":{ "from":"0001-01-01T00:00:00Z", "to":"9999-12-31T21:59:59.9999999Z", "include_lower":true, "include_upper":false } } }, { "term":{ "PreorderAvailableDate$$date":"9999-12-31T21:59:59.9999999Z" } } ] } ] } ] }, { "or":[ { "range":{ "EndDate$$date":{ "from":"0001-01-01T00:00:00Z", "to":"9999-12-31T21:59:59.9999999Z", "include_lower":false, "include_upper":true } } }, { "term":{ "EndDate$$date":"0001-01-01T00:00:00Z" } } ] }, { "term":{ "CatalogEntryCode$$string.lowercase":"77777777" } } ] } } }, "filter":{ "term":{ "___types":"EPiServer.Commerce.FindSearchProvider.FindDocument" } } } } }
As usual, I can guess it is 3-4 weeks away. We'll work on it as soon as we can but it will still have to go through code review and QA tests. Just don't take my words as promises.
/Q
Hi,
The bug is now fixed and will be delivered in FindCommerce 9.5.1. You can track it here: http://world.episerver.com/support/Bug-list/bug/COM-1222
Regards.
/Q
Dont know about FindCommerce 9.5.1 as we are not using it,
but it seems to be fixed in EPiServer.Commerce.FindSearchProvider.8.12.1
Using:
Have following exception in commerce manager catalog search view:
exception:
Mediachase.Search.config: