mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Compare commits
1 Commits
issue/8878
...
issue/8881
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6a752d1ef |
@@ -5,7 +5,6 @@ using Orchard.Projections.Descriptors.Filter;
|
||||
using Orchard.Projections.Descriptors.Layout;
|
||||
using Orchard.Projections.Descriptors.Property;
|
||||
using Orchard.Projections.Descriptors.SortCriterion;
|
||||
using Orchard.Projections.Models;
|
||||
|
||||
namespace Orchard.Projections.Services
|
||||
{
|
||||
@@ -24,12 +23,7 @@ namespace Orchard.Projections.Services
|
||||
IEnumerable<ContentItem> GetContentItems(int queryId, int skip = 0, int count = 0);
|
||||
IEnumerable<ContentItem> GetContentItems(int queryId, ContentPart part, int skip = 0, int count = 0);
|
||||
|
||||
IEnumerable<IHqlQuery> GetContentQueries(
|
||||
QueryPartRecord queryRecord,
|
||||
IEnumerable<SortCriterionRecord> sortCriteria,
|
||||
Dictionary<string, object> tokens);
|
||||
|
||||
int GetCount(int queryId);
|
||||
int GetCount(int queryId, ContentPart part);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,7 +128,7 @@ namespace Orchard.Projections.Services
|
||||
var queryRecord = _queryRepository.Get(queryId) ?? throw new ArgumentException("queryId");
|
||||
|
||||
// Prepare tokens.
|
||||
var tokens = new Dictionary<string, object>();
|
||||
Dictionary<string, object> tokens = new Dictionary<string, object>();
|
||||
if (part != null)
|
||||
{
|
||||
tokens.Add("Content", part.ContentItem);
|
||||
@@ -151,11 +151,17 @@ namespace Orchard.Projections.Services
|
||||
{
|
||||
var availableSortCriteria = DescribeSortCriteria().ToList();
|
||||
|
||||
var queryRecord = _queryRepository.Get(queryId) ?? throw new ArgumentException("queryId");
|
||||
var queryRecord = _queryRepository.Get(queryId);
|
||||
|
||||
if (queryRecord == null)
|
||||
{
|
||||
throw new ArgumentException("queryId");
|
||||
}
|
||||
|
||||
var contentItems = new List<ContentItem>();
|
||||
|
||||
// Prepare tokens.
|
||||
var tokens = new Dictionary<string, object>();
|
||||
Dictionary<string, object> tokens = new Dictionary<string, object>();
|
||||
if (part != null)
|
||||
{
|
||||
tokens.Add("Content", part.ContentItem);
|
||||
@@ -180,8 +186,7 @@ namespace Orchard.Projections.Services
|
||||
return Enumerable.Empty<ContentItem>();
|
||||
}
|
||||
|
||||
var version = queryRecord.VersionScope.ToVersionOptions();
|
||||
var groupQuery = _contentManager.HqlQuery().ForVersion(version).Where(alias => alias.Named("ci"), x => x.InG("Id", ids));
|
||||
var groupQuery = _contentManager.HqlQuery().Where(alias => alias.Named("ci"), x => x.InG("Id", ids));
|
||||
|
||||
// Iterate over each sort criteria to apply the alterations to the query object.
|
||||
foreach (var sortCriterion in queryRecord.SortCriteria.OrderBy(s => s.Position))
|
||||
@@ -195,8 +200,8 @@ namespace Orchard.Projections.Services
|
||||
Tokens = tokens
|
||||
};
|
||||
|
||||
var category = sortCriterion.Category;
|
||||
var type = sortCriterion.Type;
|
||||
string category = sortCriterion.Category;
|
||||
string type = sortCriterion.Type;
|
||||
|
||||
// Find specific sort criterion.
|
||||
var descriptor = availableSortCriteria
|
||||
@@ -250,8 +255,8 @@ namespace Orchard.Projections.Services
|
||||
Tokens = tokens
|
||||
};
|
||||
|
||||
var category = filter.Category;
|
||||
var type = filter.Type;
|
||||
string category = filter.Category;
|
||||
string type = filter.Type;
|
||||
|
||||
// Find specific filter.
|
||||
var descriptor = availableFilters
|
||||
@@ -282,8 +287,8 @@ namespace Orchard.Projections.Services
|
||||
Tokens = tokens
|
||||
};
|
||||
|
||||
var category = sortCriterion.Category;
|
||||
var type = sortCriterion.Type;
|
||||
string category = sortCriterion.Category;
|
||||
string type = sortCriterion.Type;
|
||||
|
||||
// Find specific sort criterion.
|
||||
var descriptor = availableSortCriteria
|
||||
|
||||
@@ -18,12 +18,13 @@ namespace Orchard.Search.Helpers
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
var pair = item.Split(new[] { ':' }, StringSplitOptions.None);
|
||||
var index = pair[0];
|
||||
var fields = pair[1].Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
var pair = item.Split(new[] { ':' });
|
||||
var index = pair[0].Trim();
|
||||
var fields = pair[1].Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(s => s.Trim()).ToArray();
|
||||
|
||||
dictionary[index] = fields;
|
||||
}
|
||||
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user