Lexical search is particularly suitable for short text queries because its keyword-based matching aligns closely with how users express simple or specific information needs. When queries contain only one or two terms, the likelihood of ambiguity is lower, and exact word matching often yields relevant results. For example, a query like “error code 404” or “Milvus index type” benefits from Lexical search because the system directly locates documents containing those exact phrases. The absence of complex context makes keyword matching both fast and accurate in such cases.
From a technical standpoint, Lexical search engines are optimized for this behavior through inverted indexes and efficient term-based scoring algorithms like BM25. These systems can quickly compute relevance by counting occurrences and weighting them by document length or rarity. Since short queries typically involve fewer tokens, the lookup and ranking process is extremely fast, resulting in sub-second responses even on large datasets. Lexical search’s deterministic nature also ensures explainability—developers and users can see precisely why a document was retrieved, based on matching words or phrases.
When combined with Milvus, Lexical search becomes even more powerful for handling both short and long queries. For short ones, Lexical search can serve as the primary retrieval mechanism, guaranteeing precision. For longer, ambiguous queries, embeddings stored in Milvus can introduce semantic flexibility. For example, if a user searches “optimize vector query,” Lexical search might find documents containing “vector optimization,” while Milvus identifies semantically similar discussions on “query performance tuning.” Thus, Lexical search remains ideal for concise, unambiguous searches but integrates seamlessly with vector retrieval to handle broader contexts.
