Application: PHP - Laravel v5.7
Hello and good day!
I'm developing a web application that is similar to a search engine, whereas a user will enter words that will be designated to the variable
$keywords . Then I have this query to search throughout my index:
$params = [ 'index' => 'my_index', 'type' => 'my_type', 'from' => 0, 'size' => 10, 'body' => [ "query" => [ 'bool' => [ 'must' => [ [ "query_string" => [ "fields" => ['title','content'], "query" => $keywords ] ] ] ] ] ] ]; $articles = $client->search($params);
Now, in line with my previous post, I was able to count the number of occurrences my
$keywords occurred within the documents of my index.
highlight query that is attached to the
"highlight" => [ "fields" => [ "content" => ["number_of_fragments" => 0], "title" => ["number_of_fragments" => 0] ] 'require_field_match' => true ]
Even though that the
$keywords are enclosed with double quotation mark ("), the
highlighter still chops/separates the
$keywords and I already specified them with double quotation mark to strictly follow these
For example, my $keywords contains
"Ayala Alabang" , but as I displayed the output, it goes like this
$keywords were separated, but according to the output, they're just adjacent to each other.
Is there any other tweaks or revision to my query? I found some related posts or questions in some forums, their last reply was from March 2019 but still no answers, any advice would be an greatly appreciated and an excellent help for this dilemma