Skip to content
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

Globally unique but language specific index #316

Closed
novoj opened this issue Nov 7, 2023 · 6 comments · Fixed by #358
Closed

Globally unique but language specific index #316

novoj opened this issue Nov 7, 2023 · 6 comments · Fixed by #358
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@novoj
Copy link
Collaborator

novoj commented Nov 7, 2023

Currently we support uniqueGlobally attributes, which behave as a unique index over that attribute among all entities, regardless of the locale of the attribute, if the attribute is also localized. In some projects we want to use this index for URL attributes, but we only store relative URLs in the database. If the locale is bound (can be derived) to the missing part of the url - the domain/hostname - the URL will be the same for multiple locale variants and thus the globally unique constraint will be broken in this situation.

We need to optionally support two `uniqueGlobally' behaviors:

  • IN_ALL_LOCALES: current behavior
  • LOCALE_SPECIFIC: new behavior where the database will only check for attribute uniqueness among attributes in the same locale.

The second behavior disables the functionality of the implicit locale, which can no longer be derived from the unique attribute in the filter constraint for attributes with LOCALE_SPECIFIC uniqueness - since multiple locales can match the same content of the attribute value.

@novoj novoj added the enhancement New feature or request label Nov 7, 2023
@novoj novoj added this to the Alpha milestone Nov 7, 2023
@novoj novoj self-assigned this Nov 7, 2023
@lukashornych
Copy link
Collaborator

lukashornych/evitalab#77

@lukashornych
Copy link
Collaborator

lukashornych/evitalab#78

@novoj novoj changed the title Globaly unique but language specific index Globally unique but language specific index Dec 1, 2023
novoj added a commit that referenced this issue Dec 1, 2023
Currently we support `uniqueGlobally` attributes, which behave as a unique index over that attribute among all entities, regardless of the locale of the attribute, if the attribute is also `localized`. In some projects we want to use this index for URL attributes, but we only store relative URLs in the database. If the locale is bound (can be derived) to the missing part of the url - the domain/hostname - the URL will be the same for multiple locale variants and thus the globally unique constraint will be broken in this situation.

We need to optionally support two `uniqueGlobally' behaviors:

- **IN_ALL_LOCALES**: current behavior
- **LOCALE_SPECIFIC**: new behavior where the database will only check for attribute uniqueness among attributes in the same locale.

The second behavior disables the functionality of the implicit locale, which can no longer be derived from the unique attribute in the filter constraint for attributes with LOCALE_SPECIFIC uniqueness - since multiple locales can match the same content of the attribute value.
@novoj novoj linked a pull request Dec 1, 2023 that will close this issue
@novoj
Copy link
Collaborator Author

novoj commented Dec 1, 2023

Implementation is done. @lukashornych can you please adapt REST / GraphQL implementations to reflect the change that unique attributes (either global or collection wide) can now be locale specific? We would need to require locale for all request on those attributes. Also please check my changes in external API libraries.

@lukashornych
Copy link
Collaborator

The GQL and REST APIs are adapted. There is only one test that strangely doesn't pass because of default ordering of entities but I hope that after we merge dev, it will work.

@lukashornych
Copy link
Collaborator

Only missing is now evitaLab... will work on that now.

@lukashornych
Copy link
Collaborator

evitaLab is now implemented and commited into the evitaDB codebase as well.

@novoj novoj closed this as completed in #358 Dec 6, 2023
novoj added a commit that referenced this issue Dec 6, 2023
…e-specific-index

#316 globaly unique but language specific index
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants