A search for “apple juice” can match documents containing those words, but keyword overlap alone does not capture every relationship in meaning. An embedding represents the meaning of text or other content as a numerical vector. A query and documents mapped into the same vector space can be compared for similarity, giving a search engine another way to rank results. section 13.1 section 1.1
A vector is a list of feature values. A house, for example, can be represented by its price, size, and bedroom count: [100000, 1000, 2]. Text embeddings use learned features instead of such directly named attributes. Each dimension has a value indicating how strongly its latent feature appears in the text; real model-generated features need not have simple labels. section 2.3 section 9.4.1
Figure 2.10 Dense embeddings with reduced dimensions. In this case, instead of one dimension per term (exists or missing), now higher-level dimensions exist that score shared attributes across items such as “healthy”, contains “caffeine” or “bread” or “dairy”, or whether the item is “food” or a “drink”.
The food-item diagram contrasts one-dimension-per-term vectors with reduced-dimension embeddings that score shared attributes across items. section 2.3
Keep the vector and its representation distinct. A dense representation stores values for every dimension, including zeros; a sparse representation keeps only present features. In search, “dense vector search” commonly means searching compact embeddings whose dimensions are mostly nonzero. An inverted index instead supports sparse, term-based representations with potentially far more dimensions. Semantic search is not limited to dense embeddings: sparse expansions can also express relationships beyond literal keyword matches. section 3.1.1 section 3.1.3 section 7.4.3
What keyword vectors miss
Map “apple juice” into a vector space with one dimension per known term: its query vector has 1 for “apple” and “juice” and 0 elsewhere. Two quite different documents can then receive the same cosine score when both match those terms. Changing the representation or its feature weights is necessary if the ranking should distinguish them on more than that overlap. section 3.1.1 section 3.1.2 section 3.1.3
For a content-based search pipeline, retrieve product text, encode it with an embedding model, and retain the resulting vectors for comparison or personalization. One implementation uses Python’s SentenceTransformer("all-mpnet-base-v2") and model.encode(product_names) to generate product embeddings. Document embeddings can also be combined with user interactions to build an evolving personalization profile. Evaluate the results rather than assuming similarity alone settles relevance: personalization can frustrate users when pushed too far. section 9.4.1 section 9.4 section 9.6














































