-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
ID issue #156
Comments
Hi! 👋 Thanks for raising this issue. Didn't realize anyone would have this issue this soon! Had to refresh my memory on how to set a primary key ( final instance = await Mimir.defaultInstance;
final index = instance.getIndex('movies');
await index.updateSettings(primaryKey: 'id'); That is easy enough, but I would want to also do (as a syntactic simplification): final instance = await Mimir.defaultInstance;
final index = instance.getIndex('movies', primaryKey: 'id'); But Perhaps I could come to some sort of middle ground, such as: final instance = await Mimir.defaultInstance;
final index = await instance.openIndexWithSettings('movies', primaryKey: 'id', someOtherSetting: true); This would open a How does that sound? Any suggestions for a better method name (I'm not completely sold on Note: changing the pkey after some initial documents are added may result in an error, but I am not sure. That is part of the reason I originally didn't add the feature. |
Thanks for bringing this up when you did; found a slight hiccup in milli that I'll need to make a PR for (you wouldn't be able to reopen a |
Mimir is really unique and demanded in my opinion! And it's exactly what I need. Even I've used Isar before(and other libs) and even this one is in dev phase, I picked it instead of Isar for search because search is so much powerful out of the box. await index.updateSettings(primaryKey: 'id'); This looks okay. For (rare?) cases when the default behaviour is not working. |
You can take a peek at #157, which hopefully will be done sometime tomorrow. I'll try to publish a new dev release shortly thereafter. Mimir wraps around milli (part of meilisearch) under the hood and milli looks for fields ending in "id" to set the PK, which is where your ambiguity issue comes from. TL;DR You will be able to do: final instance = await Mimir.defaultInstance;
final index = await instance.openIndex('movies', primaryKey: 'id'); But to maintain backwards compatibility, you can also do: final instance = await Mimir.defaultInstance;
final index = instance.getIndex('movies');
await index.updateSettings(primaryKey: 'id')
|
Fixes #156 TODO: - [x] `instance.openIndex` - [x] PR to meilisearch with the update pkey in settings fix - [x] Point milli in this PR to my fork - [x] Tests with manually set PK - [x] Update docs
@vsly-ru Will make a new dev release for this now! Should be on pub.dev in a few hours once everything builds in CI. |
3608: In a settings update, check to see if the primary key actually changes before erroring out r=irevoire a=GregoryConrad Previously, if the primary key was set and a Settings update contained a primary key, an error would be returned. However, this error is not needed if the new PK == the current PK. This PR just checks to see if the PK actually changes before raising an error. I came across this slight hiccup in GregoryConrad/mimir#156 (comment) Co-authored-by: Gregory Conrad <gregorysconrad@gmail.com>
As stated in the readme:
I have
id
field, but alsocategoryId
,rootId
,createdById
, etc.In my case it'd be enough if mimir first checked for an
id
field and only then continues search for fields ending in id.But for configurability reasons it's better to clearly specify
id
field during documents import.The text was updated successfully, but these errors were encountered: