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

Method test_example

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

Source from the content-addressed store, hash-verified

546
547 @pytest.mark.redismod
548 def test_example(self, client):
549 # Creating the index definition and schema
550 client.ft().create_index((TextField("title", weight=5.0), TextField("body")))
551
552 # Indexing a document
553 client.hset(
554 "doc1",
555 mapping={
556 "title": "RediSearch",
557 "body": "Redisearch impements a search engine on top of redis",
558 },
559 )
560
561 # Searching with complex parameters:
562 q = Query("search engine").verbatim().no_content().paging(0, 5)
563
564 res = client.ft().search(q)
565 assert res is not None
566
567 @pytest.mark.redismod
568 @skip_if_redis_enterprise()

Callers

nothing calls this directly

Calls 9

TextFieldClass · 0.90
QueryClass · 0.90
create_indexMethod · 0.80
hsetMethod · 0.80
pagingMethod · 0.80
no_contentMethod · 0.80
ftMethod · 0.45
verbatimMethod · 0.45
searchMethod · 0.45

Tested by

no test coverage detected