You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Scout abstraction is broken: in fact when you use "Builder::search" method it is supposed to accept the string you want to search. Insted, to make this works correctly, you must add the Solr Key too.
Detailed description
It's not possible to search within some key. Or at least is impossible to do it without 'hacking' the way this driver works.
I'm using this Scout engine to use it against Solr. So far so good.
I implemented my own SearchableArray to be saved on Solr and everything works nice.
Then I tried to search within a key, but the search did not worked.
Debugging i was able to make it works: but i had to search for $key.':'.$searchString instead of $searchString alone.
Context
That's how my model is translated on Solr:
/**
* Get the indexable data array for the model.
*/
public function toSearchableArray(): array
{
//return $this->toArray();
return [
'id' => $this->id,
'terms' => \strip_tags(
\sprintf(
'%s %s %s %s %s',
$this->name,
$this->description_title,
$this->description_text,
$this->box_title,
$this->box_text,
)
),
'tags' => $this->tags->pluck('name')->toArray(),
];
}
That's the way Scout docs suggest to make search.
Eg: Search for word "Hello" into terms key:
The Scout abstraction is broken: in fact when you use "Builder::search" method it is supposed to accept the string you want to search. Insted, to make this works correctly, you must add the Solr Key too.
Detailed description
It's not possible to search within some key. Or at least is impossible to do it without 'hacking' the way this driver works.
I'm using this Scout engine to use it against Solr. So far so good.
I implemented my own SearchableArray to be saved on Solr and everything works nice.
Then I tried to search within a key, but the search did not worked.
Debugging i was able to make it works: but i had to search for
$key.':'.$searchString
instead of$searchString
alone.Context
That's how my model is translated on Solr:
That's the way Scout docs suggest to make search.
Eg: Search for word "Hello" into
terms
key:This does not works. To make it works as expected you have to "hack" it this way:
or use
where
Possible implementation
Would be nice if the "within" attribute would be used into search instead of using "where" (that is nice too)
Your environment
Include as many relevant details about the environment you experienced the bug in and how to reproduce it.
The text was updated successfully, but these errors were encountered: