@@ -250,7 +250,7 @@ describe('Resources query', function () {
250250 q : 'toast' ,
251251 filters : {
252252 subjectLiteral : [ 'S1' ] ,
253- contributorLiteral : [ 'C1' , 'C2' ]
253+ collection : [ 'C1' , 'C2' ]
254254 }
255255 } )
256256 const queries = resourcesPrivMethods . aggregationQueriesForParams ( params )
@@ -260,27 +260,27 @@ describe('Resources query', function () {
260260 expect ( Object . keys ( queries [ 0 ] . aggregations ) ) . to . have . lengthOf ( numAggregations - 2 )
261261 expect ( queries [ 0 ] . query . bool . filter ) . to . be . a ( 'array' )
262262 // Expect the subjectLiteral filter:
263- expect ( queries [ 0 ] . query . bool . filter [ 0 ] . term [ 'subjectLiteral.raw' ] === 'S1' )
264- // .. And the contributorLiteral filters:
265- expect ( queries [ 0 ] ) . to . nested . include ( { 'query.bool.filter[1].bool.should[ 0].bool.should[0].term.contributorLiteral\\.keywordLowercased ' : 'C1' } )
266- expect ( queries [ 0 ] ) . to . nested . include ( { 'query.bool.filter[1 ].bool.should[1].bool.should[0]. term.contributorLiteral\\.keywordLowercased ' : 'C2' } )
263+ expect ( queries [ 0 ] . query . bool . filter [ 1 ] . term [ 'subjectLiteral.raw' ] === 'S1' )
264+ // .. And the collection filters:
265+ expect ( queries [ 0 ] ) . to . nested . include ( { 'query.bool.filter[0].bool.should[0].term.collectionIds ' : 'C1' } )
266+ expect ( queries [ 0 ] ) . to . nested . include ( { 'query.bool.filter[0 ].bool.should[1].term.collectionIds ' : 'C2' } )
267267
268- // Expect second aggregation for subjectLiteral :
268+ // Expect second aggregation for collection :
269269 expect ( Object . keys ( queries [ 1 ] . aggregations ) ) . to . have . lengthOf ( 1 )
270- expect ( queries [ 1 ] ) . to . nested . include ( { 'aggregations.subjectLiteral.terms.field' : 'subjectLiteral.raw' } )
271- // Expect this agg to filter on the other active filter, contributorLiteral:
272- expect ( queries [ 1 ] ) . to . nested . include ( { 'query.bool.filter[0].bool.should[0].bool.should[0].term.contributorLiteral\\.keywordLowercased' : 'C1' } )
273- expect ( queries [ 1 ] ) . to . nested . include ( { 'query.bool.filter[0].bool.should[1].bool.should[0].term.contributorLiteral\\.keywordLowercased' : 'C2' } )
270+ expect ( queries [ 1 ] ) . to . nested . include ( { 'aggregations.collection.terms.field' : 'collectionIds' } )
271+ // Expect this agg to filter on the other active filter, subjectLiteral:
274272 expect ( queries [ 1 ] . query . bool . filter ) . to . have . lengthOf ( 1 )
275- expect ( queries [ 1 ] . query . bool . filter [ 0 ] . bool . should ) . to . have . lengthOf ( 2 )
276273
277- // Expect last aggregation for contributorLiteral:
274+ expect ( queries [ 1 ] . query . bool . filter [ 0 ] . term [ 'subjectLiteral.raw' ] === 'S1' )
275+
276+ // Expect last aggregation for subjectLiteral:
278277 expect ( Object . keys ( queries [ 2 ] . aggregations ) ) . to . have . lengthOf ( 1 )
279- expect ( queries [ 2 ] ) . to . nested . include ( { 'aggregations.contributorLiteral.terms.field' : 'contributorLiteral.raw' } )
280- // Expect this agg to filter on the other active filter, subjectLiteral:
278+ expect ( queries [ 2 ] ) . to . nested . include ( { 'aggregations.subjectLiteral.terms.field' : 'subjectLiteral.raw' } )
279+ // Expect this agg to filter on the other active filter, collection:
280+ expect ( queries [ 2 ] ) . to . nested . include ( { 'query.bool.filter[0].bool.should[0].term.collectionIds' : 'C1' } )
281+ expect ( queries [ 2 ] ) . to . nested . include ( { 'query.bool.filter[0].bool.should[1].term.collectionIds' : 'C2' } )
281282 expect ( queries [ 2 ] . query . bool . filter ) . to . have . lengthOf ( 1 )
282-
283- expect ( queries [ 2 ] . query . bool . filter [ 0 ] . term [ 'subjectLiteral.raw' ] === 'S1' )
283+ expect ( queries [ 2 ] . query . bool . filter [ 0 ] . bool . should ) . to . have . lengthOf ( 2 )
284284 } )
285285 } )
286286
0 commit comments