-
Notifications
You must be signed in to change notification settings - Fork 34
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
Array access method on Synonyms class don't work #22
Comments
Hello @joachim-n Can you provide a snippet from your code please? |
It's a little tricky, as I'm using the Drupal https://www.drupal.org/project/search_api_typesense module, which is itself using this package. |
Ignoring how I get hold of the collection in the first place, here's some sample code:
|
@joachim-n can you please explain from where you are getting this method and what it is contain. $collection = $typesense->retrieveCollection($collection_name); I can not find it in our package. |
Sorry - it's from the integration module in Drupal: https://git.drupalcode.org/project/search_api_typesense/-/blob/1.0.x/src/Api/SearchApiTypesenseService.php#L124 |
Looks like you would be better off using the method outlined here in the docs eg. It might be you are looking at an outdated php client or that it is a custom one. |
Description
The array access methods such as offsetExists() on the Synonyms class don't work as expected.
Steps to reproduce
If I get the Synonyms object for a collection and call retrieve() on it, the result is an array whose 'synonyms' key shows I have a number of synonyms. Each synonym array has the root, ID, and synonym words.
However, if I do
isset($my_synonyms[$id]))
with one of the IDs, I get FALSE.This appears to be because $this->synonyms is never populated with data from the API call.
Expected Behavior
Array access method should reflect the actual data.
Actual Behavior
Always returns FALSE.
Metadata
Typsense Version: v4.7.0
OS: MacOS
The text was updated successfully, but these errors were encountered: