Skip to content

Commit

Permalink
Merge pull request #4284 from bbc/conal/IMAGEDAM-1675-sendToCaptureFi…
Browse files Browse the repository at this point in the history
…lter

IMAGEDAM-1675: Added to Photo Sales Chip
  • Loading branch information
rebecca-thompson authored Aug 20, 2024
2 parents 2fe757c + d9cfca1 commit c2473bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions kahuna/public/js/search/structured-query/query-suggestions.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ querySuggestions.factory('querySuggestions', ['mediaApi', 'editsApi', function(m
if (window._clientConfig.recordDownloadAsUsage === true) {
suggestions.push('download');
}
if (window._clientConfig.showSendToPhotoSales) {
suggestions.push('Added to Photo Sales');
}

return suggestions;
}
Expand Down
9 changes: 7 additions & 2 deletions media-api/app/lib/elasticsearch/QueryBuilder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@ class QueryBuilder(matchFields: Seq[String], overQuotaAgencies: () => List[Agenc
case MultipleField(fields) => makeMultiQuery(condition.value, fields)
case SingleField(field) => condition.value match {
// Force AND operator else it will only require *any* of the words, not *all*
case Words(value) => matchQuery(resolveFieldPath(field), value).operator(Operator.AND)
case Phrase(value) => matchPhraseQuery(resolveFieldPath(field), value)
case Words(value) =>
matchQuery(resolveFieldPath(field), value).operator(Operator.AND)
case Phrase(value) => value match {
case "Added to Photo Sales" =>
matchPhraseQuery(resolveFieldPath(field), "syndication")
case _ => matchPhraseQuery(resolveFieldPath(field), value)
}
case DateRange(start, end) => rangeQuery(resolveFieldPath(field)).gte(printDateTime(start)).lte(printDateTime(end))
case e => throw InvalidQuery(s"Cannot do single field query on $e")
}
Expand Down

0 comments on commit c2473bb

Please sign in to comment.