From 015139d04b4a1c5ad111e12e95b9a9fc4699638f Mon Sep 17 00:00:00 2001 From: bach Date: Wed, 24 Feb 2021 10:48:07 +0100 Subject: [PATCH] added sapi_solr query condition on field_reference --- web/modules/custom/materio_sapi/src/Controller/Base.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/web/modules/custom/materio_sapi/src/Controller/Base.php b/web/modules/custom/materio_sapi/src/Controller/Base.php index 313f291..614f22e 100644 --- a/web/modules/custom/materio_sapi/src/Controller/Base.php +++ b/web/modules/custom/materio_sapi/src/Controller/Base.php @@ -34,11 +34,13 @@ class Base extends ControllerBase { // Set fulltext search keywords and fields. $this->query->keys($this->keys); - // $this->query->setFulltextFields(['name']); + // $this->query->setFulltextFields(['field_reference']); // Set additional conditions. - // $this->query->addCondition('status', 1) - // ->addCondition('author', 1, '<>'); + // in case we search for material reference like W0117 + if (preg_match('/^[WTRPCMFGSO]\d{4}$/i', $this->keys, $matches)) { + $this->query->addCondition('field_reference', $this->keys); + } // Restrict the search to specific languages. // $this->query->setLanguages(['de', 'it']);