mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
@@ -14,6 +14,7 @@ namespace Orchard.Taxonomies.Projections {
|
|||||||
|
|
||||||
public class TermsFilter : IFilterProvider {
|
public class TermsFilter : IFilterProvider {
|
||||||
private readonly ITaxonomyService _taxonomyService;
|
private readonly ITaxonomyService _taxonomyService;
|
||||||
|
private int _termsFilterId;
|
||||||
|
|
||||||
public TermsFilter(ITaxonomyService taxonomyService) {
|
public TermsFilter(ITaxonomyService taxonomyService) {
|
||||||
_taxonomyService = taxonomyService;
|
_taxonomyService = taxonomyService;
|
||||||
@@ -55,14 +56,13 @@ namespace Orchard.Taxonomies.Projections {
|
|||||||
var allIds = allChildren.Select(x => x.Id).ToList();
|
var allIds = allChildren.Select(x => x.Id).ToList();
|
||||||
|
|
||||||
switch(op) {
|
switch(op) {
|
||||||
case 0:
|
case 0: // is one of
|
||||||
// is one of
|
// Unique alias so we always get a unique join everytime so can have > 1 HasTerms filter on a query.
|
||||||
Action<IAliasFactory> s = alias => alias.ContentPartRecord<TermsPartRecord>().Property("Terms", "terms").Property("TermRecord", "termRecord");
|
Action<IAliasFactory> s = alias => alias.ContentPartRecord<TermsPartRecord>().Property("Terms", "terms" + _termsFilterId++);
|
||||||
Action<IHqlExpressionFactory> f = x => x.InG("Id", allIds);
|
Action<IHqlExpressionFactory> f = x => x.InG("TermRecord.Id", allIds);
|
||||||
context.Query.Where(s, f);
|
context.Query.Where(s, f);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1: // is all of
|
||||||
// is all of
|
|
||||||
foreach (var id in allIds) {
|
foreach (var id in allIds) {
|
||||||
var termId = id;
|
var termId = id;
|
||||||
Action<IAliasFactory> selector =
|
Action<IAliasFactory> selector =
|
||||||
|
|||||||
Reference in New Issue
Block a user