Skip to content

Commit

Permalink
VCST-154: search by localized content field
Browse files Browse the repository at this point in the history
  • Loading branch information
ksavosteev committed Jul 24, 2024
1 parent 134ef14 commit f4a395b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ public IndexSearchRequestBuilder WithSearchPhrase(string searchPhrase)
public IndexSearchRequestBuilder WithCultureName(string cultureName)
{
CultureName = cultureName;

if (!string.IsNullOrEmpty(CultureName))
{
SearchRequest.SearchFields.Add($"__content_{cultureName}".ToLowerInvariant());
}

return this;
}

Expand All @@ -98,24 +104,24 @@ public IndexSearchRequestBuilder AddCertainDateFilter(DateTime certainDate)
{
FieldName = "startdate",
Values = [new RangeFilterValue
{
Lower = null,
Upper = certainDate.ToString("O"),
IncludeLower = false,
IncludeUpper = true,
}]
{
Lower = null,
Upper = certainDate.ToString("O"),
IncludeLower = false,
IncludeUpper = true,
}]
};

var endDateFilter = new RangeFilter
{
FieldName = "enddate",
Values = [new RangeFilterValue
{
Lower = certainDate.ToString("O"),
Upper = null,
IncludeLower = false,
IncludeUpper = true,
}]
{
Lower = certainDate.ToString("O"),
Upper = null,
IncludeLower = false,
IncludeUpper = true,
}]
};

AddFiltersToSearchRequest([startDateFilter, endDateFilter]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,13 @@ public virtual async Task<SearchProductResponse> Handle(SearchProductQuery reque
CatalogId = store.Catalog,
};

builder.WithCultureName(criteria.LanguageCode);

//Use predefined facets for store if the facet filter expression is not set
if (responseGroup.HasFlag(ExpProductResponseGroup.LoadFacets))
{
var predefinedAggregations = await _aggregationConverter.GetAggregationRequestsAsync(criteria, new FiltersContainer());

builder.WithCultureName(criteria.LanguageCode);
builder.ParseFacets(_phraseParser, request.Facet, predefinedAggregations)
.ApplyMultiSelectFacetSearch();
}
Expand Down

0 comments on commit f4a395b

Please sign in to comment.