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

Unstable results when running the same query twice #4627

Open
Kerollmops opened this issue May 10, 2024 · 2 comments
Open

Unstable results when running the same query twice #4627

Kerollmops opened this issue May 10, 2024 · 2 comments
Labels
bug Something isn't working as expected

Comments

@Kerollmops
Copy link
Member

Describe the bug
When running the following query, the engine is returning unstable results. Note that everything is on the private Discord conversation with our customer.

{
    "displayedAttributes": [
        "*"
    ],
    "searchableAttributes": [
        "title"
    ],
    "filterableAttributes": [
        "category",
        "category_ids",
        "channel",
        "handle",
        "language",
        "made_for_kids",
        "num_ab_tests",
        "shorts",
        "subscriber_count",
        "upload_date",
        "view_count",
        "xf90"
    ],
    "sortableAttributes": [
        "upload_date",
        "view_count",
        "xf90"
    ],
    "rankingRules": [
        "words",
        "typo",
        "proximity",
        "sort",
        "exactness"
    ],
    "stopWords": [],
    "nonSeparatorTokens": [],
    "separatorTokens": [],
    "dictionary": [],
    "synonyms": {},
    "distinctAttribute": null,
    "proximityPrecision": "byWord",
    "typoTolerance": {
        "enabled": true,
        "minWordSizeForTypos": {
            "oneTypo": 5,
            "twoTypos": 9
        },
        "disableOnWords": [],
        "disableOnAttributes": []
    },
    "faceting": {
        "maxValuesPerFacet": 100,
        "sortFacetValuesBy": {
            "*": "alpha"
        }
    },
    "pagination": {
        "maxTotalHits": 300000000
    },
    "searchCutoffMs": null
}

To Reproduce
Unfortunately, we don't have a clear reproducer but running the above query multiple times.

Expected behavior
The results must be stable and sorted by xf90.

Meilisearch version:
v1.8.0

Additional context
Running on a dedicated Digital Ocean instance on the Cloud.

@Kerollmops Kerollmops added the bug Something isn't working as expected label May 10, 2024
@dureuill
Copy link
Contributor

dureuill commented May 13, 2024

A reason for result unstability introduced in v1.8 is the search cutoff.

I'm pretty sure this is what we're seeing.
To confirm, one can take a look at the score details looking for Skipped ranking rules.

If the behavior is undesirable, one should increase the search-cutoff-ms setting.

@Kerollmops
Copy link
Member Author

Kerollmops commented May 13, 2024

Thank you, @dureuill 👏

You found the issue! This is only because the searchCutoffMs was set to 1500s, which stopped the computation and returned very non-relevant results. So, it is expected, and there is a workaround to increase the cutoff timing simply.

With the Default Cutoff

"_rankingScoreDetails": {
    "words": {
        "order": 0,
        "matchingWords": 1,
        "maxMatchingWords": 1,
        "score": 1.0
    },
    "typo": {
        "order": 1,
        "typoCount": 0,
        "maxTypoCount": 1,
        "score": 1.0
    },
    "proximity": {
        "order": 2,
        "score": 1.0
    },
    "xf90:desc": {
        "order": 3,
        "value": 258587.8854961832
    },
    "skipped": {
        "order": 4
    }
}

With a High Cutoff Everything is Fine

"_rankingScoreDetails": {
    "words": {
        "order": 0,
        "matchingWords": 1,
        "maxMatchingWords": 1,
        "score": 1.0
    },
    "typo": {
        "order": 1,
        "typoCount": 0,
        "maxTypoCount": 1,
        "score": 1.0
    },
    "proximity": {
        "order": 2,
        "score": 1.0
    },
    "xf90:desc": {
        "order": 3,
        "value": 258587.8854961832
    },
    "exactness": {
        "order": 4,
        "matchType": "noExactMatch",
        "matchingWords": 0,
        "maxMatchingWords": 1,
        "score": 0.16666666666666666
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

2 participants