A collection is a search-engine unit with its own schema and configuration. Documents are indexed into it; queries use it to search, rank, and retrieve results. Create the collection before loading documents, then search the fields relevant to the task. section 3.2.1 section 13.4.1
Create, index, and search
A small text-ranking test creates a collection, adds documents with id, title, and description fields, then searches description for “the cat in the hat.” Requesting score and an explanation makes the BM25 ranking inspectable. In Python, the sequence is engine.create_collection("cat_in_the_hat"), collection.add_documents(docs), then collection.search(**request). section 3.2.1
A collection’s fields reflect its job. An outdoors collection holds both questions and answers: post_type distinguishes them, parent_id links answers to questions, and accepted_answer_id identifies a selected answer. A search can restrict results to questions while querying title and body. Metadata such as view_count is also available as a potential relevance signal. section 13.4.1
A separate entities collection serves query interpretation rather than ordinary result retrieval. It stores surface forms to match in incoming queries, canonical forms to normalize them, types, and popularity values that help choose among ambiguous matches. Its Solr text-tagger configuration supports fast entity extraction; the resulting matches can be assembled into a typed query tree. section 7.4.1
Listing 13.1 Indexing the outdoors dataset
outdoors_collection = engine.create_collection("outdoors")
outdoors_dataframe = load_outdoors_data("data/outdoors/posts.csv")
outdoors_collection.write(outdoors_dataframe)
The Python listing shows the collection lifecycle in one place: create the outdoors collection, load post data, and write it for indexing. section 13.4.1















