From 622139f71930122c8971c8ed16e4876283349a73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Randy=20=C4=8Cupi=C4=87?= Date: Mon, 19 Aug 2019 13:53:02 +0200 Subject: [PATCH] Implement custom field sort clause --- .../Content/Query/SortClause/CustomField.php | 23 +++++++++++++ .../Common/SortClauseVisitor/CustomField.php | 34 +++++++++++++++++++ .../search/solr/sort_clause_visitors.yml | 6 ++++ 3 files changed, 63 insertions(+) create mode 100644 lib/API/Values/Content/Query/SortClause/CustomField.php create mode 100644 lib/Core/Search/Solr/Query/Common/SortClauseVisitor/CustomField.php diff --git a/lib/API/Values/Content/Query/SortClause/CustomField.php b/lib/API/Values/Content/Query/SortClause/CustomField.php new file mode 100644 index 00000000..cb033b0e --- /dev/null +++ b/lib/API/Values/Content/Query/SortClause/CustomField.php @@ -0,0 +1,23 @@ +target . $this->getDirection($sortClause); + } +} diff --git a/lib/Resources/config/search/solr/sort_clause_visitors.yml b/lib/Resources/config/search/solr/sort_clause_visitors.yml index a8e190a9..a899f9c4 100644 --- a/lib/Resources/config/search/solr/sort_clause_visitors.yml +++ b/lib/Resources/config/search/solr/sort_clause_visitors.yml @@ -17,3 +17,9 @@ services: tags: - {name: ezpublish.search.solr.query.content.sort_clause_visitor} - {name: ezpublish.search.solr.query.location.sort_clause_visitor} + + netgen.search.solr.query.common.sort_clause_visitor.custom_field: + class: Netgen\EzPlatformSearchExtra\Core\Search\Solr\Query\Common\SortClauseVisitor\CustomField + tags: + - {name: ezpublish.search.solr.query.content.sort_clause_visitor} + - {name: ezpublish.search.solr.query.location.sort_clause_visitor}