-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Appeding Model Path on generating ID from scoutKey with Modle #209
Comments
Hey @MadaniTech, what issues are caused in your side about having the model path on the objectID? |
Thanks for the response @nunomaduro. Is this right to show the path on response while fetching the results from search query? I am writing my logics which also impact on directory path and on the fly I am showing this path as objectID in response. |
Yeah - at the moment, moving the model from directory will force you to reimport all records. Maybe we can improve this in the future. |
Can I modify it for the time for my project? In case please help me out. Thanks @nunomaduro. |
I would also like to override the objectID because saving the entire model path makes no sense if I'm searching from the javascript frontend. I would like the objectIDs to be customised so they can just be Laravel has a public function toSearchableArray()
{
return [
'objectID' => class_basename($this) . '::' . $this->id,
'name' => $this->name,
'description' => $this-> description,
];
} |
+1 |
Scout Extended is wonderful with its latest features to use Algolia Search API in laravel. But It has a bad approach to save value of Model path with ScoutKey.
On encryption it is using following in ObjectIdEncrypter:
`public static function encrypt($searchable, int $part = null): string {
$scoutKey = method_exists($searchable, 'getScoutKey') ? $searchable->getScoutKey() : $searchable->getKey();
$meta = [get_class($searchable->getModel()), $scoutKey];
if ($part !== null) {
$meta[] = $part;
}
return implode(self::$separator, $meta);
}`
Because of this ObjectID is importing like this:
objectID: {ModelPath}::ScoutKey
on importing and searching results also show a string including Model Path.
Any body can help in this matter.
The text was updated successfully, but these errors were encountered: