Skip to content

Commit 52499b6

Browse files
committed
Fixed query to match exact-match syntax
1 parent 76da272 commit 52499b6

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

tests/test_asyncio/test_search.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -683,12 +683,11 @@ async def test_explaincli(decoded_r: redis.Redis):
683683

684684

685685
@pytest.mark.redismod
686-
@skip_if_server_version_gte("7.9.0")
687686
async def test_summarize(decoded_r: redis.Redis):
688687
await createIndex(decoded_r.ft())
689688
await waitForIndex(decoded_r, "idx")
690689

691-
q = Query("king henry").paging(0, 1)
690+
q = Query("\"king henry\"").paging(0, 1)
692691
q.highlight(fields=("play", "txt"), tags=("<b>", "</b>"))
693692
q.summarize("txt")
694693

@@ -700,7 +699,7 @@ async def test_summarize(decoded_r: redis.Redis):
700699
== doc.txt
701700
)
702701

703-
q = Query("king henry").paging(0, 1).summarize().highlight()
702+
q = Query("\"king henry\"").paging(0, 1).summarize().highlight()
704703

705704
doc = sorted((await decoded_r.ft().search(q)).docs)[0]
706705
assert "<b>Henry</b> ... " == doc.play
@@ -716,7 +715,7 @@ async def test_summarize(decoded_r: redis.Redis):
716715
== doc["extra_attributes"]["txt"]
717716
)
718717

719-
q = Query("king henry").paging(0, 1).summarize().highlight()
718+
q = Query("\"king henry\"").paging(0, 1).summarize().highlight()
720719

721720
doc = sorted((await decoded_r.ft().search(q))["results"])[0]
722721
assert "<b>Henry</b> ... " == doc["extra_attributes"]["play"]

tests/test_search.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -643,24 +643,24 @@ def test_explaincli(client):
643643

644644

645645
@pytest.mark.redismod
646-
@skip_if_server_version_gte("7.9.0")
647646
def test_summarize(client):
648647
createIndex(client.ft())
649648
waitForIndex(client, getattr(client.ft(), "index_name", "idx"))
650649

651-
q = Query("king henry").paging(0, 1)
650+
q = Query("\"king henry\"").paging(0, 1)
652651
q.highlight(fields=("play", "txt"), tags=("<b>", "</b>"))
653652
q.summarize("txt")
654653

655654
if is_resp2_connection(client):
655+
print(client.ft().search(q).docs)
656656
doc = sorted(client.ft().search(q).docs)[0]
657657
assert "<b>Henry</b> IV" == doc.play
658658
assert (
659659
"ACT I SCENE I. London. The palace. Enter <b>KING</b> <b>HENRY</b>, LORD JOHN OF LANCASTER, the EARL of WESTMORELAND, SIR... " # noqa
660660
== doc.txt
661661
)
662662

663-
q = Query("king henry").paging(0, 1).summarize().highlight()
663+
q = Query("\"king henry\"").paging(0, 1).summarize().highlight()
664664

665665
doc = sorted(client.ft().search(q).docs)[0]
666666
assert "<b>Henry</b> ... " == doc.play
@@ -676,7 +676,7 @@ def test_summarize(client):
676676
== doc["extra_attributes"]["txt"]
677677
)
678678

679-
q = Query("king henry").paging(0, 1).summarize().highlight()
679+
q = Query("\"king henry\"").paging(0, 1).summarize().highlight()
680680

681681
doc = sorted(client.ft().search(q)["results"])[0]
682682
assert "<b>Henry</b> ... " == doc["extra_attributes"]["play"]

0 commit comments

Comments
 (0)