tokens sort criteria (#8382)

* Tokenized state for sort criteria

* Tokenized state also in the other place where sort criteria are used
This commit is contained in:
Matteo Piovanelli
2020-06-05 12:37:35 +02:00
committed by GitHub
parent f0c5b62b20
commit 2bc7079593

View File

@@ -166,10 +166,12 @@ namespace Orchard.Projections.Services {
// iterate over each sort criteria to apply the alterations to the query object
foreach (var sortCriterion in queryRecord.SortCriteria.OrderBy(s => s.Position)) {
var tokenizedState = _tokenizer.Replace(sortCriterion.State, tokens);
var sortCriterionContext = new SortCriterionContext {
Query = groupQuery,
State = FormParametersHelper.ToDynamic(sortCriterion.State),
QueryPartRecord = queryRecord
State = FormParametersHelper.ToDynamic(tokenizedState),
QueryPartRecord = queryRecord,
Tokens = tokens
};
string category = sortCriterion.Category;
@@ -212,7 +214,8 @@ namespace Orchard.Projections.Services {
var filterContext = new FilterContext {
Query = contentQuery,
State = FormParametersHelper.ToDynamic(tokenizedState),
QueryPartRecord = queryRecord
QueryPartRecord = queryRecord,
Tokens = tokens
};
string category = filter.Category;
@@ -236,10 +239,12 @@ namespace Orchard.Projections.Services {
// iterate over each sort criteria to apply the alterations to the query object
foreach (var sortCriterion in sortCriteria.OrderBy(s => s.Position)) {
var tokenizedState = _tokenizer.Replace(sortCriterion.State, tokens);
var sortCriterionContext = new SortCriterionContext {
Query = contentQuery,
State = FormParametersHelper.ToDynamic(sortCriterion.State),
QueryPartRecord = queryRecord
State = FormParametersHelper.ToDynamic(tokenizedState),
QueryPartRecord = queryRecord,
Tokens = tokens
};
string category = sortCriterion.Category;