search api phrase query instead of direct
This commit is contained in:
parent
0a9b1291e7
commit
5df81ea019
@ -17,7 +17,14 @@ use Drupal\search_api\Entity\Index;
|
||||
*/
|
||||
class Search extends ControllerBase {
|
||||
|
||||
|
||||
private $content_type;
|
||||
private $index;
|
||||
private $results;
|
||||
private $or_query;
|
||||
private $phrase;
|
||||
private $keys;
|
||||
private $offset;
|
||||
private $limit;
|
||||
|
||||
// private $limit = 15;
|
||||
// private $offset = 0;
|
||||
@ -48,7 +55,7 @@ class Search extends ControllerBase {
|
||||
// - « phrase » => Single phrase
|
||||
// - " edismax " => ???
|
||||
$or_parse_mode = \Drupal::service('plugin.manager.search_api.parse_mode')
|
||||
->createInstance('direct');
|
||||
->createInstance('phrase');
|
||||
$or_parse_mode->setConjunction('OR');
|
||||
$this->or_query->setParseMode($or_parse_mode);
|
||||
|
||||
@ -105,9 +112,9 @@ class Search extends ControllerBase {
|
||||
*/
|
||||
private function parseRequest(Request $request){
|
||||
// Get the typed string from the URL, if it exists.
|
||||
$this->keys = $request->query->get('keys');
|
||||
if($this->keys){
|
||||
$this->keys = mb_strtolower($this->keys);
|
||||
$this->phrase = $request->query->get('phrase');
|
||||
if($this->phrase){
|
||||
$this->keys = mb_strtolower($this->phrase);
|
||||
$this->keys = Tags::explode($this->keys);
|
||||
// \Drupal::logger('ouatt_searchapi')->notice($this->keys);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user