From eb7ff88c15d6cea10fd7ec89c435bd4a3a1613e6 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Wed, 1 Feb 2023 07:20:31 +0000 Subject: [PATCH] Fix context view for certain mtypes --- core/db/elastic.py | 2 +- core/lib/context.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/db/elastic.py b/core/db/elastic.py index c05fc42..87571f1 100644 --- a/core/db/elastic.py +++ b/core/db/elastic.py @@ -108,7 +108,7 @@ class ElasticsearchBackend(StorageBackend): extra_should.append({"match": {"nick": channel}}) else: for ctype in types: - extra_should.append({"equals": {"mtype": ctype}}) + extra_should.append({"match": {"mtype": ctype}}) else: for ctype in types: extra_should.append({"match": {"type": ctype}}) diff --git a/core/lib/context.py b/core/lib/context.py index dcb242e..53d31bd 100644 --- a/core/lib/context.py +++ b/core/lib/context.py @@ -4,7 +4,7 @@ def construct_query(index, net, channel, src, num, size, type=None, nicks=None): extra_should = [] extra_should2 = [] if num: - extra_must.append({"equals": {"num": num}}) + extra_must.append({"match_phrase": {"num": num}}) if net: extra_must.append({"match_phrase": {"net": net}}) if channel: @@ -52,7 +52,7 @@ def construct_query(index, net, channel, src, num, size, type=None, nicks=None): extra_should.append({"match": {"nick": channel}}) else: for ctype in types: - extra_should.append({"equals": {"mtype": ctype}}) + extra_should.append({"match": {"mtype": ctype}}) else: for ctype in types: extra_should.append({"match": {"type": ctype}})