DEV Community

Cover image for When vector search needs a graph metadata filter
Conor Bronsdon
Conor Bronsdon

Posted on Originally published at chainofthought.show

When vector search needs a graph metadata filter

Use a vector index when the job is finding passages that sit near the question in meaning. Filter on metadata stored with the vector when the constraint is a property of the hit, such as genre. Add a graph of entities and relationships when a near neighbor can still be the wrong fact because the constraint is a link between records. Sudhir Hasbe put plain vector RAG around 60% to 65% accuracy, and said customers using graph and graph RAG, a vector search plus a metadata filter, or graph traversal with vectors, were way above 90% accurate.

Hasbe, President and Chief Product Officer at Neo4j, made that case on Chain of Thought in April 2026. Bob van Luijt, CEO and co-founder of Weaviate, described the other half in January 2025: the first use cases his customers took to production were large-scale search, mostly hybrid search.

When is a vector database enough?

A vector database is enough when relevance is topical closeness over unstructured text, and a near miss is still a useful hit. Van Luijt said the first production use cases he saw were large-scale search, mostly hybrid search. He later said 95 percent of Weaviate's customers sit in the bucket of doing existing search and recommendation better.

the first use cases that we saw, go to production was just more large scale, just search, right? So, and then mostly hybrid search.

Bob van Luijt, CEO and co-founder of Weaviate, on Chain of Thought ep 8

AI Infrastructure & the Evolut… - Chain of Thought | AI Agents, Infrastructure & Engineering - Apple Podcasts

Podcast Episode · Chain of Thought | AI Agents, Infrastructure & Engineering · January 8, 2025 · 35m

favicon podcasts.apple.com

Chunk, embed, retrieve. Hybrid search helps when the query also carries rare tokens an embedding might blur. Stop there if the eval only asks whether the passage is on the same subject.

Similarity does not store a constraint. Two passages can sit next to each other in vector space because they share style, entities, or co-occurrence, while the fact you need may be metadata stored on the passage or a link between records: genre, account, product line, jurisdiction. A vector index can apply a metadata filter while it retrieves. When the constraint is a relationship, treat the index as the recall step and use graph traversal to keep the neighbors that share that link.

How do you filter vector hits with graph metadata?

When the constraint is a field on the hit, apply it during vector retrieval and keep fetching past the first page until enough eligible hits remain. When the constraint is a relationship, walk the graph and use vectors beside that traversal. Hasbe's illustration came from a podcast he had listened to, the chief product officer of LinkedIn interviewing Spotify's CTO.

you may be listening to a pop song and suddenly the next vector similarity could show you in country music or some other music genre. Because in vector space, it's just mathematical similarities that you're looking at.

Sudhir Hasbe, President and Chief Product Officer at Neo4j, on Chain of Thought ep 55

In that retelling, users wanted another song like the pop song they were on, and the next neighbor could be a different genre. Spotify had acquired a metadata company for background on songs, and used that metadata as context to restrict results to the domain the listener was in.

when I say graph RAG, it is a combination of, I can do a vector search, And then I'm applying a filtering layer with all the other metadata as a graph layer on top of it.

Sudhir Hasbe, President and Chief Product Officer at Neo4j, on Chain of Thought ep 55

He also said you can start from graph traversal and bring vectors in beside it. Vectors propose a neighborhood. The graph says which neighbors share the relationship you meant.

A minimal sketch to adapt, not a drop-in library.

# Hypothetical catalog. Genre is metadata; artist is a relationship similarity will not infer.
GRAPH = {
    "song:midnight": {"genre": "pop", "artist": "artist:north"},
    "song:highway": {"genre": "country", "artist": "artist:west"},
    "song:neon": {"genre": "pop", "artist": "artist:north"},
}

# Country ranks first on purpose, so a one-hit page is not enough.
RANKED = [
    {"id": "song:highway", "text": "wide open road", "score": 0.93},
    {"id": "song:neon", "text": "city lights", "score": 0.81},
    {"id": "song:midnight", "text": "late chorus", "score": 0.74},
]

def vector_search(query, k=8, offset=0):
    return [dict(hit) for hit in RANKED[offset:offset + k]]

def retrieve(query, seed, k=8):
    seed_meta = GRAPH[seed]
    kept = []
    offset = 0
    while len(kept) < k:
        hits = vector_search(query, k=k, offset=offset)
        if not hits:
            break
        offset += len(hits)
        for hit in hits:
            if hit["id"] == seed:
                continue
            meta = GRAPH.get(hit["id"])
            if meta is None or meta["genre"] != seed_meta["genre"]:
                continue
            same_artist = meta["artist"] == seed_meta["artist"]
            hit["rank"] = hit["score"] + (0.05 if same_artist else 0.0)
            kept.append(hit)
            if len(kept) == k:
                break
    return sorted(kept, key=lambda h: h["rank"], reverse=True)
Enter fullscreen mode Exit fullscreen mode

vector_search is a stand-in for whatever index you already run. Genre is metadata filtered while the index is scanned, so a country track that ranks first cannot crowd out a later pop song. The artist value is the relationship: same-artist is a soft boost, and that link is what graph traversal is for. The hard genre check is what stops a confident wrong neighbor from reaching the model.

What accuracy numbers did Hasbe attach to the filter?

Teams that began on pure RAG or vector search, L'Oreal and RocketMultigen among them, were seeing accuracy around 60%, 65%, Hasbe said, and other research lands in that range. With graph and graph RAG, customers were way above 90% accurate. Once a reasoning engine and more targeted tools sit on graph plus vectors, he said you can get above 95% or 97% over a period of time. Hasbe said pure similarity search is never going to be enough on its own, and he called it non-deterministic. The gap he illustrated is semantic: a stable nearest neighbor can still be the wrong genre.

He pointed to research on the web moving from 60% or 65% accuracy to 90% or 95% plus, with the biggest gains on complex questions where the facts are interrelated across documents or inside a large set. Measure the same split on your own set, where a wrong genre, account, or policy counts as a miss.

He named three benefits: accuracy, easier development, and explainability and auditability. Accuracy on complex questions. Easier development, because entities and relationships can be inspected, while a vector space is hard to look at and explain. Explainability and auditability, so you can name the links behind a choice.

FAQ

Should a newer model replace the metadata filter?
Hasbe's answer to skipping infrastructure was that a simple document search can take a shortcut, and that many enterprise cases are more than a vector search that finds a document. He said he would focus on accuracy and on being able to audit the decision. If your errors are wrong neighbors with high similarity, a stronger generator still has to condition on those neighbors.

Does the graph replace the vector index?
Hasbe defined graph RAG as a vector search plus a metadata filter as a graph layer, or graph traversal used with vectors. Van Luijt's customers reached production first on large-scale search, mostly hybrid. Keep the index for recall over text. Add edges where closeness and correctness come apart.

How much structure do you need before the filter helps?
Enough to express the constraint your errors violate. In the Spotify retelling, genre metadata was what stopped a pop session from surfacing country. Hasbe said most adopters he sees start with a semantic map, or that map plus some domain data.

Takeaway

  • Ship vector or hybrid search when the test is topical closeness over unstructured text.
  • Add a graph filter when a near neighbor can be the wrong entity, genre, account, or rule.
  • Define graph RAG the way Hasbe did: vector search, then metadata and relationships as a filter, or traversal plus vectors.
  • Hasbe's bands: about 60% to 65% for vector-only starts, way above 90% for graph-plus-vector customers, and above 95% or 97% over a period of time once reasoning engines get targeted tools.
  • Log which edge kept each hit, and grow the graph from the relations that fail.

The longer explainer, with the episode clips, is on Chain of Thought. It draws on this episode.

Subscribe to the Chain of Thought newsletter for new episodes and write-ups like this one.

Drafted with AI assistance from the episode transcripts.

Top comments (1)

Collapse
 
userxnom profile image
Abdullah Naseer •

The line I keep coming back to is the one in your sketch: genre is a hard check, artist is a +0.05 soft boost. That distinction is doing more work than the post says, because your own list of what a near neighbor can get wrong — entity, genre, account, rule — does not split cleanly into hard and soft. A wrong-genre song is a bad recommendation; a wrong-account document reaching the model is a leak, not a ranking miss. The soft boost only works where being wrong is cheap.

The numbers make the same point from the other side. Hasbe's 60–65% for vector-only versus way above 90% with graph is a huge gap, but it hides which failures the graph fixed. If you ran your own eval and split the misses into wrong-genre, wrong-entity, and missing-edge, I suspect the three would want three different fixes — and your takeaway about logging which edge kept each hit is exactly how you would see that split.

So the question I would love to see you answer next: for your four — entity, genre, account, rule — which ones are hard filters and which are soft boosts, and what decides it? Is it the cost of being wrong, or something about the data itself?