Reputation: 81
I use Elasticsearch with Laravel, I implement everything and it works with simple match queries like in the code above.
'body' => [
"query" => [
"bool" => [
"should" => [
["regexp" => [
"tags" => [
"value" => ".{2,8}" . $query . ".*",
]
],
],
["wildcard" => [
"tags" => [
"value" => "*" . $query . "*",
"boost" => 1.0,
"rewrite" => "constant_score"
]
]
]
]],
], "highlight" => [
"fields" => [
"tags" => ["type" => "plain"]
]
]
]
I receive good results like on query "java" I receive both "javascript" & "nativjavascript" But the problem is with receiving results in phrases.
I want to type in query "java react" and want to receive this results: "java","javascript","javascript reactjs", "reactjs","react", "nativjavascript".
Upvotes: 0
Views: 271
Reputation: 32386
I am not familiar with Laravel, hence can't provide you the exact syntax but can tell the approach and how I solved this use-case in my application.
space
, in your case java react
, should be split into 2 search term java
and react
.Upvotes: 1