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

Method test_example

tests/test_search.py:548–565  ·  tests/test_search.py::TestBaseSearchFunctionality.test_example
(self, client)

Source from the content-addressed store, hash-verified

546
547 @pytest.mark.redismod
548 def test_example(self, client):
549 class="cm"># Creating the index definition and schema
550 client.ft().create_index((TextField(class="st">"title", weight=5.0), TextField(class="st">"body")))
551
552 class="cm"># Indexing a document
553 client.hset(
554 class="st">"doc1",
555 mapping={
556 class="st">"title": class="st">"RediSearch",
557 class="st">"body": class="st">"Redisearch impements a search engine on top of redis",
558 },
559 )
560
561 class="cm"># Searching with complex parameters:
562 q = Query(class="st">"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