소스 검색

added sapi_solr query condition on field_reference

bach 3 년 전
부모
커밋
015139d04b
1개의 변경된 파일5개의 추가작업 그리고 3개의 파일을 삭제
  1. 5 3
      web/modules/custom/materio_sapi/src/Controller/Base.php

+ 5 - 3
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']);