NEWVectors or files. Pick a path.Start →
    Back to DiagramsRetrieval Mechanics

    Your Search Can Return a Number

    "camping gear" against a 118 image index returns 60 documents. Add one aggregate stage and the same query returns $27,989 across 60 items at $466 average. The retrieval still runs; the aggregate computes over exactly what it found.

    A portrait diagram. The headline reads Your search can return a number, with the subline: one aggregate stage turns a result set into an answer, same retriever, same query, same index. A rail badged without it shows 60 documents, everything that matched for you to read, drawn as three rows of blank result tiles with the note and 30 more, correct, and not an answer; the chip reads 60 rows. A dark band reads query camping gear, stage aggregate, 60 to 1, with three large figures: 27,989 dollars total_value, 60 items, 466 dollars avg_price. Three smaller cards give the same pipeline on other queries: floor lamp 21,445 dollars across 43 items at 499 average, armchair 21,706 dollars across 50 items at 434 average, camping gear 27,989 dollars across 60 items at 466 average. A bold line states that the retrieval still happens and the aggregate runs on what it found, so the number answers the question you actually asked. A code window shows the execute request with query camping gear and a highlighted second stage, stage_id aggregate with aggregations count, sum and avg on price. The footer prints mxp.co/d/search-returns-a-number.
    "camping gear" against a 118 image index returns 60 documents. Add one aggregate stage and the same query returns $27,989 across 60 items at $466 average. The retrieval still runs; the aggregate computes over exactly what it found.

    Ask a 118 image index for camping gear and you get 60 documents. That is correct, and it is a list to read rather than an answer to the question you had.

    Add one aggregate stage to the same retriever and the same query returns a total of 27,989 dollars across 60 items, averaging 466 dollars. The stage config is one block: count, sum and average over price.

    The retrieval still happens first. Semantic search decides what matches, and the aggregation computes over exactly that set, so the number answers the question as asked instead of a category somebody had to define in advance. Three queries, three answers, one pipeline: floor lamp 21,445 dollars across 43 items, armchair 21,706 dollars across 50, camping gear 27,989 dollars across 60.

    This is the part of retrieval pipelines that gets missed. Every stage after the search is a transformation over the matched set, and the output of the last stage is whatever that stage produces. A ranked list is one choice. A count, a sum, a distribution or a single row are others, and they cost one config block each.

    What is real here: the photos are Pexels images with every photographer credited, the embeddings and executions ran against the live API, and the totals are the ones the aggregate stage returned. Prices are demo catalog data generated for this corpus, so the dollar figures describe the demo, and the mechanism is the point.

    Run this on your own data

    Mixpeek turns video, images, audio, and documents in your object storage into searchable, timestamped results through one API.

    Search your own data