AI Glossary / Retrieval and knowledge systems / Intermediate
Term-at-a-time
Definition
Term-at-a-time is a query-scoring strategy that processes one query term's postings before moving to another query term. It adds each term's contribution to document score accumulators. After the required contributions are combined, the system selects the highest-scoring documents.
What it means
Many retrieval scores combine evidence from several query terms. A document may receive one contribution for battery and another for recycling. Term-at-a-time scoring organizes the work around those terms: update documents using battery's postings, then update documents using recycling's postings.
The accumulators hold partial document scores while the process continues. A document absent from one term's postings can still receive contributions from other terms, depending on the query's retrieval semantics.
This is a traversal and accumulation strategy, not a specific relevance formula. It can be used with different additive scoring models. It also differs from document-at-a-time scoring, which advances through query-term postings together to finish a document's contributions before moving on.
How it works
The system prepares the query terms and their weights, obtains the postings list for a term and calculates its contribution to each listed document. It adds that contribution to the document's accumulator, creating or initializing the accumulator as needed.
The process repeats for the remaining query terms. A scoring model may then require document-length normalization or another final adjustment before top-k selection. Query-independent contributions must be included in the intended way rather than accidentally added once per term.
A simple exhaustive version reads all relevant postings. More advanced versions may limit or prune work, but need justified bounds for exact results or an explicit approximation policy. Accumulator storage can be substantial when common terms touch many documents. Dense arrays and sparse maps make different trade-offs.
Three practical examples
- A keyword-search prototype adds tf-idf-style contributions one query term at a time.
- A retrieval teaching tool displays how each term changes the current score for every candidate document.
- A search-engine experiment compares term-at-a-time and document-at-a-time traversal while keeping the underlying relevance formula fixed.
Think of it this way
Think of marking an exam one question at a time. You add the score for question one to every student's running total, then do the same for question two.
The analogy concerns the order of accumulation. It does not imply that search terms are independent measures of merit, or that a partial total is enough to decide the final ranking before the other contributions are known.
Worked example
Following the accumulators
An invented query contains alpha with query weight 2 and beta with query weight 1. Use a simple unnormalized dot-product score. Alpha's postings give document weights D1 = 3 and D2 = 1. Beta's postings give D2 = 4 and D3 = 2.
After processing alpha, the accumulators are D1 = 2 × 3 = 6 and D2 = 2 × 1 = 2. D3 has no contribution yet. Processing beta adds 1 × 4 to D2 and 1 × 2 to D3, giving final scores D1 = 6, D2 = 6 and D3 = 2.
D1 and D2 tie for first place, so a declared tie-breaking rule is needed if only one result is requested. If the intended model were cosine similarity, document normalization would still be required; the totals above are not automatically cosine scores. The example isolates traversal from the scoring formula.
Illustrative case study
The fictional CedarLibrary team implements a term-at-a-time search baseline. Its first version selects a leader after processing the rarest query term and stops. Reviewers find queries where another document receives a large contribution from a later term and should win.
The team restores complete accumulation for its exact baseline. It evaluates any proposed early-stopping optimization separately and checks that score normalization occurs consistently. The explanation interface can show each term's contribution without describing intermediate leaders as final winners.
The case is fictional and reports no measured performance gain. It illustrates why traversal order alone does not justify discarding unseen evidence.
Common misconceptions and mistakes
- Term-at-a-time scores only one term per query. It processes all required query terms, sequentially by term.
- The first high accumulator is guaranteed to remain the winner. Later terms can change the ranking.
- The strategy defines a unique relevance model. It specifies how contributions are gathered, not which contributions are appropriate.
Business use
Term-at-a-time scoring is useful as a clear baseline for inverted-index retrieval. It can exploit sequential access through a term's postings and makes score contributions easy to inspect.
Evaluate memory use for accumulators and the work caused by frequent query terms. Keep the same tokenization, weights, normalization and candidate rules when comparing traversal strategies. If an implementation skips postings or caps accumulators, report whether results remain exact under a proven condition or become approximate. Performance claims should cover representative query lengths and term frequencies, not just a favorable short query.
People also ask
Must every document have an accumulator?
A simple array can reserve one per document, while sparse implementations store only candidates that receive contributions.
Can query terms be processed in different orders?
Yes. Exact additive scoring yields the same mathematical total, although floating-point rounding, pruning and resource use can depend on the order.
Is term-at-a-time the same as term partitioning?
No. One concerns query evaluation order; the other concerns how an index is distributed across machines.
Check your understanding
After the first query term, D1 has score 5 and D2 has score 2. Can D1 be declared the final winner solely from those partial scores?
Answer: No. Contributions from unprocessed terms can change the ordering. Exact early stopping requires additional justified information, such as suitable upper bounds.
Related terms
- Document-at-a-time
- Inverted index
- Dot product
- Cosine similarity
- accumulator
- postings list
- top-k retrieval
- query processing
Learn next
Read document-at-a-time scoring and vector-space retrieval. Calculate the same small query using both traversal orders and verify that the final scores agree when the scoring model and candidates are identical.
More in Retrieval and knowledge systems
- Tag (metadata) - A Tag (metadata) is a descriptive label or attribute associated with a resource to help identify, organize, filter, or manage it.
- Term discrimination
- Term partitioning - Term partitioning distributes an inverted index across machines by assigning different vocabulary terms to different partitions.
- Thesaurus (information retrieval) - A Thesaurus (information retrieval) is a structured vocabulary used to describe and retrieve information consistently.
- Tiered indexes - Tiered indexes organize retrieval information into levels so a search can examine a promising subset first and fall back to broader levels when needed.
- Topic-specific PageRank - Topic-specific PageRank is a PageRank distribution biased toward a chosen topic by changing where the modeled random surfer teleports.
Sources
Christopher Manning, Prabhakar Raghavan and Hinrich Schutze, Introduction to Information Retrieval, Computing vector scores: https://nlp.stanford.edu/IR-book/html/htmledition/computing-vector-scores-1.html
The authors' accumulation strategy and distinction from document-at-a-time traversal were read. The alpha/beta example is original and explicitly uses unnormalised dot products. No pruning guarantee or hardware benchmark is implied by the example.
Previous: Term Next: Term discrimination