|
@@ -53,7 +53,7 @@ class Base extends ControllerBase {
|
|
$this->and_query->setParseMode($parse_mode);
|
|
$this->and_query->setParseMode($parse_mode);
|
|
// Set fulltext search keywords and fields.
|
|
// Set fulltext search keywords and fields.
|
|
if ($this->keys) {
|
|
if ($this->keys) {
|
|
- $this->and_query->keys($this->keys);
|
|
|
|
|
|
+ $this->and_query->keys(implode(' ', $this->keys));
|
|
}
|
|
}
|
|
|
|
|
|
// in case of term id provided restrict the keys to taxo fields
|
|
// in case of term id provided restrict the keys to taxo fields
|
|
@@ -166,7 +166,7 @@ class Base extends ControllerBase {
|
|
|
|
|
|
// Set fulltext search keywords and fields.
|
|
// Set fulltext search keywords and fields.
|
|
if ($this->keys) {
|
|
if ($this->keys) {
|
|
- $this->or_query->keys($this->keys);
|
|
|
|
|
|
+ $this->or_query->keys(implode(' ', $this->keys));
|
|
}
|
|
}
|
|
|
|
|
|
// exclude results from and_query
|
|
// exclude results from and_query
|
|
@@ -176,7 +176,7 @@ class Base extends ControllerBase {
|
|
}
|
|
}
|
|
$this->or_query->addConditionGroup($exclude_and_results_conditions);
|
|
$this->or_query->addConditionGroup($exclude_and_results_conditions);
|
|
|
|
|
|
- if (preg_match_all('/[WTRPCMFGSO]\d{4}/i', $this->keys, $matches)) {
|
|
|
|
|
|
+ if (preg_match_all('/[WTRPCMFGSO]\d{4}/i', implode(' ', $this->keys), $matches)) {
|
|
// in case we search for material references like W0117
|
|
// in case we search for material references like W0117
|
|
$ref_conditions = $this->or_query->createConditionGroup('OR');
|
|
$ref_conditions = $this->or_query->createConditionGroup('OR');
|
|
foreach ($matches[0] as $key => $value) {
|
|
foreach ($matches[0] as $key => $value) {
|
|
@@ -264,8 +264,8 @@ class Base extends ControllerBase {
|
|
$this->keys = $request->query->get('keys');
|
|
$this->keys = $request->query->get('keys');
|
|
if($this->keys){
|
|
if($this->keys){
|
|
$this->keys = mb_strtolower($this->keys);
|
|
$this->keys = mb_strtolower($this->keys);
|
|
- // $this->keys = Tags::explode($this->keys);
|
|
|
|
- \Drupal::logger('materio_sapi')->notice($this->keys);
|
|
|
|
|
|
+ $this->keys = Tags::explode($this->keys);
|
|
|
|
+ // \Drupal::logger('materio_sapi')->notice($this->keys);
|
|
}
|
|
}
|
|
// get the exacte term id in case of autocomplete
|
|
// get the exacte term id in case of autocomplete
|
|
// $this->terms = $request->query->get('terms');
|
|
// $this->terms = $request->query->get('terms');
|
|
@@ -301,7 +301,7 @@ class Base extends ControllerBase {
|
|
|
|
|
|
$this->sapiQuery();
|
|
$this->sapiQuery();
|
|
|
|
|
|
- $resp['keys'] = $this->keys;
|
|
|
|
|
|
+ $resp['keys'] = json_encode($this->keys);
|
|
$resp['terms'] = json_encode($this->terms);
|
|
$resp['terms'] = json_encode($this->terms);
|
|
$resp['filters'] = $this->filters;
|
|
$resp['filters'] = $this->filters;
|
|
// $resp['count'] = $this->results->getResultCount();
|
|
// $resp['count'] = $this->results->getResultCount();
|
|
@@ -313,7 +313,7 @@ class Base extends ControllerBase {
|
|
));
|
|
));
|
|
if ($this->keys) {
|
|
if ($this->keys) {
|
|
$resp['infos'] .= t(' keywords @keys', array(
|
|
$resp['infos'] .= t(' keywords @keys', array(
|
|
- "@keys" => $this->keys
|
|
|
|
|
|
+ "@keys" => implode(', ', $this->keys)
|
|
));
|
|
));
|
|
}
|
|
}
|
|
if ($this->keys && $this->filters) {
|
|
if ($this->keys && $this->filters) {
|
|
@@ -389,7 +389,7 @@ class Base extends ControllerBase {
|
|
];
|
|
];
|
|
|
|
|
|
if ($this->keys) {
|
|
if ($this->keys) {
|
|
- $resp['#title'] = $this->keys;
|
|
|
|
|
|
+ $resp['#title'] = implode(', ', $this->keys);
|
|
|
|
|
|
// $this->sapiQuery();
|
|
// $this->sapiQuery();
|
|
|
|
|