전문 검색을 위한 RediSearch
Redis 데이터에 강력한 전문 검색 기능을 구현하여 애플리케이션 기능을 향상합니다.
전문 검색을 위한 RediSearch은(는) CoddyKit의 무료 Redis Caching & Messaging (Pub/Sub, Streams) 강의입니다. 이것은 4개 중 2번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Redis Caching & Messaging (Pub/Sub, Streams) 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Redis Caching & Messaging (Pub/Sub, Streams) 강의에는 총 4개의 강의가 포함되어 있습니다.
이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.
Unlock Powerful Search
Welcome! In this lesson, we'll dive into RediSearch, a powerful Redis module. It transforms Redis into a robust, real-time search engine.
RediSearch allows you to perform fast, complex full-text searches directly on your Redis data, enhancing your application's features significantly.
RediSearch: A Redis Module
RediSearch isn't part of Redis's core functionality; it's an add-on module. Redis modules extend Redis with new data types and commands.
Think of it as adding a specialized search engine feature directly into your Redis instance, making it incredibly efficient for search operations.
Creating Your First Index
Before you can search, you need to define an index. An index tells RediSearch which fields in your data (typically Redis Hashes) are searchable and how.
The FT.CREATE command is used to set up this schema. Let's create an index named myProductIndex with title and description text fields.
FT.CREATE myProductIndex SCHEMA title TEXT WEIGHT 5.0 description TEXTAdding Documents to the Index
Once your index is defined, you can start adding documents to it. RediSearch indexes Redis Hashes, so you'll first store your data as a Hash, then add it to the index using FT.ADD.
The score (e.g., 1.0) influences relevance ranking.
HSET product:1 title "RediSearch Guide" description "A comprehensive guide to full-text search with Redis modules."
HSET product:2 title "Redis Caching Strategies" description "Learn advanced caching patterns using Redis."
FT.ADD myProductIndex product:1 1.0 FIELDS title "RediSearch Guide" description "A comprehensive guide to full-text search with Redis modules."
FT.ADD myProductIndex product:2 1.0 FIELDS title "Redis Caching Strategies" description "Learn advanced caching patterns using Redis."Performing Basic Searches
Now that we have data indexed, let's perform a simple full-text search using the FT.SEARCH command.
You just specify the index name and your query term. RediSearch will look for the term across all indexed text fields.
FT.SEARCH myProductIndex "search"
FT.SEARCH myProductIndex "Redis"Field-Specific Searches
Sometimes you need to search only within a specific field. RediSearch allows you to target your queries using the @field:term syntax.
This helps you get more precise results, for example, by searching only in the title field.
FT.SEARCH myProductIndex "@title:Redis"
FT.SEARCH myProductIndex "@description:guide"Prefix and Phrase Searches
RediSearch supports advanced query syntax for more flexible searches. You can use prefix searches (e.g., red* for anything starting with 'red') or search for exact phrases.
Exact phrases are enclosed in double quotes.
FT.SEARCH myProductIndex "red*"
FT.SEARCH myProductIndex "\"full-text search\""Using Tag Fields for Filtering
For exact filtering, like categorizing items, RediSearch offers TAG fields. These are optimized for checking exact matches rather than full-text relevance.
Let's add a category tag field and demonstrate how to query it. We'll need a new index or to alter an existing one, but for simplicity, imagine it's part of myProductIndex.
FT.CREATE booksIdx SCHEMA title TEXT author TAG
FT.ADD booksIdx book:1 1.0 FIELDS title "Redis Essentials" author "John Doe, Jane Smith"
FT.ADD booksIdx book:2 1.0 FIELDS title "Advanced Redis" author "Jane Smith"
FT.SEARCH booksIdx "@author:{John Doe}"
FT.SEARCH booksIdx "@author:{Jane Smith|John Doe}"Quick Check
You want to create a RediSearch index named articles with two fields:
headline: a text field for full-text search.topic: a tag field for exact topic filtering.
Which command correctly creates this index?
RediSearch: Powerful Search in Redis
In this lesson, you learned how RediSearch extends Redis with powerful full-text search capabilities.
- We covered creating an index with a schema using
FT.CREATE. - You saw how to add documents with
FT.ADDand perform basic searches usingFT.SEARCH. - We explored field-specific queries, prefix searches, phrase searches, and the use of TAG fields for exact filtering.
RediSearch is a fantastic tool for adding robust search features directly to your Redis applications, making data retrieval faster and more flexible!
AI 튜터와 함께 Redis Caching & Messaging (Pub/Sub, Streams)을(를) 배우세요 — 무료
브라우저에서 실제 코드를 작성하고 실행하며, 24/7 AI 튜터로부터 즉각적인 도움을 받고, 웹이나 앱에서 중단한 부분부터 계속 학습하세요.
- 코스
- 12
- 레슨
- 48
자주 묻는 질문
“전문 검색을 위한 RediSearch” 강의는 무료인가요?
네 — “전문 검색을 위한 RediSearch” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Redis Caching & Messaging (Pub/Sub, Streams) 강의 전체를 잠금 해제할 수 있습니다. Redis Caching & Messaging (Pub/Sub, Streams) 강의에는 총 4개의 강의가 포함되어 있습니다.
“전문 검색을 위한 RediSearch”에서 뭘 배우나요?
Redis 데이터에 강력한 전문 검색 기능을 구현하여 애플리케이션 기능을 향상합니다. 브라우저에서 직접 실행하는 실습 코드로 Redis Caching & Messaging (Pub/Sub, Streams)을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
Redis Caching & Messaging (Pub/Sub, Streams)을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 Redis Caching & Messaging (Pub/Sub, Streams)은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 2번째 강의입니다.
“전문 검색을 위한 RediSearch” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 Redis Caching & Messaging (Pub/Sub, Streams) 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 Redis Caching & Messaging (Pub/Sub, Streams) 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- Redis 모듈 개요
- 전문 검색을 위한 RediSearch
- RedisJSON 및 RedisGraph 기초
- RedisTimeSeries로 시계열 데이터 다루기