This chapter covers
- Executing queries and returning matching search results
- Ranking search results based upon how relevant they are to an incoming query
- Keyword match and filtering vs. vector-based ranking
- Controlling and specifying your own ranking functions with function queries
- Catering ranking functions to a specific domain
Search engines fundamentally do three things: ingest content (indexing), return content matching incoming queries (matching), and sort the returned content based upon some measure of how well it matches the query (ranking). Additional layers can be added on top to allow users to provide better queries (autosuggest, chatbot dialogs, etc.) and to extract better answers from the results or summarize the results leveraging Large Language Models (see chapters 14-15), but the core functions of the search engine typically revolve around matching and ranking on indexed data.
Relevance is the term used to describe this notion of "how well the content matches the query". Most of the time the matched content is documents, and the returned and ranked content is those matched documents along with some corresponding metadata describing the documents.