Open Nek- opened 1 year ago
Thanks for the report. Do you want to give it a try?
What is your goto ? Using the indexNameMapper everywhere ?
Along with the issue reported by @Nek- , one consequence is that I see no way as for now to retrieve dynamically Index
instance solely from a class, but maybe I am missing something.
The IndexNameMapper contains several methods to return a prefixed index name based on a class, but no way to retrieve non-prefixed index name. And since the getIndex(string $name)
method of Client
automatically prefix the given name, there's no way but to get double-prefixed index name, which means the getIndex
has to be called with a non-dynamic non-prefixed index name (not crystal clear but I guess you get it).
I could take a look at it but I'd like to know the exact scope of it, since this seems to be a BC break.
You are supposed to call Client->getIndex() to get a Index.
That means you should now the that Class FOO belong to index "yop".
If your application does not have this information, you could expose the config elsewhere:
Or maybe we should add a helper in the Client, like "getIndexFromObject"? Would that help?
Because the IndexNameMapper does not use the indexNameMapper, the prefix is never added to the index name. However, the IndexBuilder is using it and works with the prefix! It's highly disturbing.
https://github.com/jolicode/elastically/blob/96a52d1e99b848e97f3eb613dfa3cce0e892d64e/src/Indexer.php#L45