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

Identical TotalResults Cache Key for different queries #774

Closed
margaretha opened this issue Oct 4, 2024 · 1 comment
Closed

Identical TotalResults Cache Key for different queries #774

margaretha opened this issue Oct 4, 2024 · 1 comment

Comments

@margaretha
Copy link
Contributor

Identical TotalResults Cache Key for different queries have cause the problem described in KorAP/Kalamar#218

Kustvakt uses query hash-codes as cache keys. It turns out that the following queries get the same hash-code:

Response response = target().path(API_VERSION).path("search")
                .queryParam("q", "[orth=populistischer]")
                .queryParam("ql", "poliqarp")
                .queryParam("cq", "availability!=QAO-NC-LOC:ids & corpusSigle = "
                        + "/SOL|[UTSZ][0-9][0-9]/ & pubDate in 1976")
                .queryParam("fields", "corpusSigle,textSigle,pubDate,pubPlace,"
                        + "availability,textClass")
                .queryParam("access-rewrite-disabled", "true").request().get();
Response response = target().path(API_VERSION).path("search")
                .queryParam("q", "[orth=populistisches]")
                .queryParam("ql", "poliqarp")
                .queryParam("cq", "availability!=QAO-NC-LOC:ids & corpusSigle = "
                        + "/SOL|[UTSZ][0-9][0-9]/ & pubDate in 1975")
                .queryParam("fields", "corpusSigle,textSigle,pubDate,pubPlace,"
                        + "availability,textClass")
                .queryParam("access-rewrite-disabled", "true").request().get();
@margaretha
Copy link
Contributor Author

I didn't expect that Java would create the same hash-code for different queries. That happens appearently because Java hash-code method considers object structures rather than content so it misses small differences like populistischer v.s populistisches, and 1976 v.s 1975.

I have redeployed the test instance with a fix. It should create different keys now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant