MCPcopy
hub / github.com/redis/redis-py / test_stopwords

Method test_stopwords

tests/test_search.py:428–442  ·  view source on GitHub ↗
(self, client)

Source from the content-addressed store, hash-verified

426
427 @pytest.mark.redismod
428 def test_stopwords(self, client):
429 client.ft().create_index((TextField("txt"),), stopwords=["foo", "bar", "baz"])
430 client.hset("doc1", mapping={"txt": "foo bar"})
431 client.hset("doc2", mapping={"txt": "hello world"})
432 self.waitForIndex(client, getattr(client.ft(), "index_name", "idx"))
433
434 q1 = Query("foo bar").no_content()
435 q2 = Query("foo bar hello world").no_content()
436 res1, res2 = client.ft().search(q1), client.ft().search(q2)
437 if expects_resp2_shape(client) or expects_unified_shape(client):
438 assert 0 == res1.total
439 assert 1 == res2.total
440 elif expects_resp3_shape(client):
441 assert 0 == res1["total_results"]
442 assert 1 == res2["total_results"]
443
444 @pytest.mark.redismod
445 def test_filters(self, client):

Callers

nothing calls this directly

Calls 11

TextFieldClass · 0.90
QueryClass · 0.90
expects_resp2_shapeFunction · 0.85
expects_unified_shapeFunction · 0.85
expects_resp3_shapeFunction · 0.85
create_indexMethod · 0.80
hsetMethod · 0.80
no_contentMethod · 0.80
ftMethod · 0.45
waitForIndexMethod · 0.45
searchMethod · 0.45

Tested by

no test coverage detected