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

Index does not get updated when saving a model #9

Open
4 tasks done
MarkejN opened this issue Nov 19, 2024 · 0 comments
Open
4 tasks done

Index does not get updated when saving a model #9

MarkejN opened this issue Nov 19, 2024 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@MarkejN
Copy link

MarkejN commented Nov 19, 2024

Checklist before I submit this issue report

I confirm that:

My environment is:

Key Value Comments
PHP version: 8.3.12
Contao version: 4.13.50
MetaModels version: dev-release/2.3.0
Installation via composer yes
Installed MetaModels packages 28

Issue description

The levenshtein index does not get updated in my installation when saving a model. I noticed two issues:

  1. The checksum in WordList is calculated based on the relevance and not on the words (e.g. sha1(11)). If the number of words does not change, the checksum will be correct, even if the words have changed:
    $this->checksum = sha1(implode('', $this->words));
  2. Somehow $metaModel->getActiveLanguage() returns en, although the MetaModel is not translated and the locale in the backend is de. I only need and use German. When words are added after saving, they are saved for en and not for de.
    public function modelSaved($item)
    {
    $indexer = $this->getIndex();
    $blacklist = $this->getBlackList();
    $metaModel = $this->getMetaModel();
    $language = $metaModel->getActiveLanguage();

Steps to reproduce

  1. Open a model that is already indexed and change one of the words, without changing the number of words.
  2. Search for the new word in the frontend.
  3. The result is empty.
  4. Manually regenerate the search index in the backend.
  5. The result is displayed.

Describe the behaviour of the application

The result is empty.

Describe the expected behaviour of the application

The model with the word should be displayed.

Screenshots

Table tl_metamodel_levensthein with the checksums sha1(11), sha1(111), ... and language en:

image

@zonky2 zonky2 added the bug Something isn't working label Nov 19, 2024
@zonky2 zonky2 added this to the 2.3.0 milestone Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants