Why Vector Search Alone Isn’t Enough: Building AI Property Search with Advanced Filtering
From the publisher’s feed, collected in the ZeroLabs newsroom.
Imagine searching for a house with a query like:“Find me a quiet 3 bedroom apartment in South Delhi, under ₹2.5 crore, within 2 km of a metro station, with covered parking and enough space for a home office.”At first, this sounds like a simple semantic search problem. Convert the query into an embedding. Find the most similar properties. Return the results.Done.Except there is a problem. What if the most semantically similar property costs ₹3.2 crore? Or, it has only two bedrooms? Or, is it 5 km away from the nearest metro? Or, it doesn’t have parking?The property might be semantically perfect, but it still isn’t what the user asked for. And this is where I started looking at a slightly different question:Can vector search understand what I want without ignoring what I absolutely require?That question became the foundation of this project.I built an AI property search system using Qdrant, combining semantic vector search with structured filtering for price, bedrooms, area, locality, parking and geographical distance.The project uses synthetic Delhi property data, sentence-transformers/all-MiniLM-L6-v2 for embeddings, Qdrant for vector storage and filtering, and Streamlit for the UI.The interesting part isn’t simply that I used a vector database.The interesting part is why Qdrant fits this problem so well.Entire Architecture1. The Problem With Naive Vector SearchA typical vector-search pipeline looks like this:Query ↓Embedding ↓Vector Search ↓Top K ↓Filteringvector-search / naive pipeline diagramThe problem is the last step.Suppose we have 10 million properties.Vector search retrieves the 100 most similar properties. Then we apply:3 bedroomsprice covered parking = truedistance Maybe only 3 survive.The other valid properties may never have been retrieved because they weren’t inside the original top 100.post-filtering example/diagramIncreasing top_k to 500 or 5,000 is not a real solution.It increases computation, latency and the amount of data that has to be processed, while still making recall dependent on how large the initial candidate set was.So the question becomes:Can we apply the constraints while doing the retrieval itself?That’s where Qdrant becomes useful.2. Why Qdrant?I needed more than a place to store embeddings.Each property contains two fundamentally different types of information.Semantic informationThings like:quietsunlitfamily-friendlyhome-office suitablenear green coverThis belongs in the embedding.Structured informationThings like:bedroomspricearealocalityparkingbuilding agelatitudelongitudeamenitiesThis belongs in the payload.Qdrant lets me store both together:Qdrant Point│├── Vector│ └── 384-dimensional embedding│└── Payload ├── price ├── bedrooms ├── area ├── locality ├── parking ├── amenities └── locationAnd the important part is that the payload can participate in the vector query itself.Qdrant’s documentation explicitly describes payload filtering as a way to express requirements that embeddings cannot represent, such as price, location and other business constraints.3. Generating a Dataset That Actually Tests the ProblemI generated 120 synthetic Delhi property listings across 15 localities.I deliberately didn’t make every property semantically and structurally aligned.The generator creates:normal listingsType A contrast listings: semantically attractive but violating hard constraintsType B contrast listings: satisfying hard constraints but lacking the obvious semantic phrasesThe semantic phrases include:CLOSED_LIST_PHRASES = [ "quiet", "sunlit", "home-office suitable", "family-friendly", "near green cover", "lively commercial area",]The dataset also contains property type, bedrooms, price, area, locality, building age, parking, amenities and coordinates.The actual generator starts deterministically:def generate_listings(n: int = 120, seed: int = 42) -> pd.DataFrame: rng = np.random.default_rng(seed) n_type_a = 10 n_type_b = 10 n_normal = n - n_type_a - n_type_b rows = [] # Generate Type A, Type B and normal listings... # Each listing contains structured fields # and a natural-language description. return pd.DataFrame(rows)The important thing here is reproducibility.Running:python src/generate_data.pycreates the same controlled experiment instead of depending on an external dataset or API.4. Embedding the PropertiesFor semantic search I used:sentence-transformers/all-MiniLM-L6-v2It produces 384-dimensional embeddings.The ingestion code loads the model:def load_model( model_name: str = "sentence-transformers/all-MiniLM-L6-v2",) -> SentenceTransformer: return SentenceTransformer(model_name)Then I combine the title and description:def embed_listings( df: pd.DataFrame, model: SentenceTransformer,) -> list[list[float]]: texts = [] for _, row in df.iterrows(): title = row.get("title") description = row.get("description") title_ok = isinstance(title, str) and title.strip() != "" desc_ok = isinstance(description, str) and description.strip() != "" if not title_ok or not desc_ok: print(f"WARNING: skipping id={row['id']}") continue texts.append(f"{title} {description}") if not texts: return [] embeddings = model.encode(texts, show_progress_bar=False) return [vector.tolist() for vector in embeddings]I also explicitly skip invalid rows rather than letting one missing description break the entire ingestion process.5. Creating the Qdrant CollectionNow we have vectors.We need somewhere to store them.The collection is created like this:def recreate_collection( client: QdrantClient, collection_name: str = "properties",) -> None: existing = { c.name for c in client.get_collections().collections } if collection_name in existing: client.delete_collection(collection_name) client.create_collection( collection_name=collection_name, vectors_config=VectorParams( size=384, distance=Distance.COSINE ), )There are two important decisions here.Why 384?Because all-MiniLM-L6-v2 produces 384-dimensional vectors.Why cosine distance?Because we’re comparing semantic embeddings where cosine similarity is a natural similarity measure.The collection is recreated on every ingestion so that the experiment always starts from a clean state.6. Payload IndexingThis is one of the most important pieces of the project.Just storing metadata isn’t enough if we’re going to filter on it repeatedly.So I create indexes based on the actual datatype:def create_payload_indexes( client: QdrantClient, collection_name: str = "properties",) -> None:For example:client.create_payload_index( collection_name, field_name="bedrooms", field_schema=PayloadSchemaType.INTEGER,)client.create_payload_index( collection_name, field_name="price_inr", field_schema=PayloadSchemaType.INTEGER,)client.create_payload_index( collection_name, field_name="area_sqft", field_schema=PayloadSchemaType.FLOAT,)client.create_payload_index( collection_name, field_name="locality", field_schema=PayloadSchemaType.KEYWORD,)And:client.create_payload_index( collection_name, field_name="building_age_years", field_schema=PayloadSchemaType.INTEGER,)client.create_payload_index( collection_name, field_name="covered_parking", field_schema=PayloadSchemaType.BOOL,)client.create_payload_index( collection_name, field_name="floor", field_schema=PayloadSchemaType.INTEGER,)client.create_payload_index( collection_name, field_name="parking_spaces", field_schema=PayloadSchemaType.INTEGER,)Finally, for geography:client.create_payload_index( collection_name, field_name="location", field_schema=PayloadSchemaType.GEO,)So:price → INTEGERbedrooms → INTEGERarea → FLOATlocality → KEYWORDparking → BOOLlocation → GEOQdrant recommends creating payload indexes for fields that will be used for filtering because they improve filtering performance7. Storing the PropertyThe final step is creating Qdrant points.The payload looks like this:payload = { "title": str(row["title"]), "description": str(row["description"]), "property_type": str(row.get("property_type", "")), "bedrooms": int(row["bedrooms"]), "price_inr": int(row["price_inr"]), "area_sqft": float(row["area_sqft"]), "locality": str(row["locality"]), "city": str(row.get("city", "Delhi")), "building_age_years": int(row["building_age_years"]), "floor": int(row["floor"]), "covered_parking": bool(row["covered_parking"]), "parking_spaces": int(row["parking_spaces"]), "terrace_sqft": float(row.get("terrace_sqft", 0.0)), "amenities": amenities, "metro_name": str(row.get("metro_name", "")), "metro_lat": float(row.get("metro_lat", 0.0)), "metro_lon": float(row.get("metro_lon", 0.0)), "location": { "lat": float(row["latitude"]), "lon": float(row["longitude"]), },}Then:PointStruct( id=int(row["id"]), vector=vectors[vector_idx], payload=payload,)I upsert these points in batches of 50, with a retry if a batch fails.So the complete ingestion pipeline is essentially:8. Range FilteringNow comes the actual search logic.Property search is full of ranges:price area >= 1500 sqftbuilding age floor >= 5I construct Qdrant Range conditions dynamically:must_conditions = []if price_min is not None or price_max is not None: must_conditions.append( FieldCondition( key="price_inr", range=Range( gte=price_min, lte=price_max, ), ) )if area_min is not None or area_max is not None: must_conditions.append( FieldCondition( key="area_sqft", range=Range( gte=area_min, lte=area_max, ), ) )I do the same for floor and building age.Before querying Qdrant, I also validate that:min so an invalid request fails early rather than becoming a confusing database query. And then comes the important part:vector = get_embedding(query, model)hits = client.query_points( collection_name="properties", query=vector, query_filter=query_filter, limit=top_k,).pointsThe vector and the filter go into the same query.That’s the core idea of this project.9. Amenities and Structured ArraysProperties can also contain arrays:amenities = [ "gym", "security", "lift", "power_backup"]I can search for an exact amenity:query_filter = Filter( must=[ FieldCondition( key="amenities", match=MatchValue(value=amenity), ) ])Or ask for a minimum number of amenities:query_filter = Filter( must=[ FieldCondition( key="amenities", values_count=ValuesCount( gte=min_amenities ) ) ])This is useful because I don’t need to enumerate every possible amenity.Qdrant also supports true nested-object filters for arrays of objects.My implementation specifically demonstrates array filtering/cardinality rather than a large nested-object property schema, so I wouldn’t claim that I built the latter into the dataset.Qdrant itself supports nested conditions when the data structure requires multiple conditions to apply to the same nested object.10. Parking Is a Compound FilterA query like:“Give me properties with covered parking and at least two parking spaces.”becomes:query_filter = Filter( must=[ FieldCondition( key="covered_parking", match=MatchValue(value=True), ), FieldCondition( key="parking_spaces", range=Range( gte=min_parking_spaces ), ), ])Because both conditions are inside must, they have to be true together.Again:Semantic similarity+covered_parking = true+parking_spaces >= 2Qdrant’s filtering model supports these Boolean combinations directly.11. Geographic FilteringEmbeddings don’t understand physical distance.“Near Hauz Khas Metro” should not mean:“The description contains words related to Hauz Khas.”It should mean:The coordinates are actually within the requested radius.The project stores:"location": { "lat": float(row["latitude"]), "lon": float(row["longitude"]),}Then the query can use:FieldCondition( key="location", geo_radius=GeoRadius( center=GeoPoint( lat=station_lat, lon=station_lon, ), radius=radius_km * 1000, ),)I also implemented geographic bounding-box search using GeoBoundingBox.So now a single query can combine:semantic relevance+price+bedrooms+locality+parking+geographic distanceThat is much closer to real-world search.12. Boolean FilteringUsers don’t always give simple AND conditions.Consider:“I want a 3BHK under ₹2.5 crore, but I’ll consider a 2BHK if it has a large terrace.”That’s:price AND( 3BHK OR (2BHK AND terrace >= 250 sqft))ANDNOT NoidaThe actual project constructs that as:must = [ FieldCondition( key="price_inr", range=Range(lte=25_000_000), ),]should = [ FieldCondition( key="property_type", match=MatchValue(value="3BHK"), ), Filter( must=[ FieldCondition( key="property_type", match=MatchValue(value="2BHK"), ), FieldCondition( key="terrace_sqft", range=Range(gte=250), ), ] ),]must_not = [ FieldCondition( key="locality", match=MatchValue(value="Noida"), ),]And the search function accepts:def search_boolean( client, model, query, must=None, should=None, must_not=None, top_k=10,):So:must → ANDshould → ORmust_not → NOTQdrant supports recursively combined Boolean clauses, which is exactly what makes these kinds of AI-generated structured queries possible.13. The Most Important Comparison: Pre vs Post FilteringThis is the experiment I actually wanted to run.Naive post-filteringQuery ↓Embedding ↓Vector Search ↓500 candidates ↓Python filters ↓Discard invalid properties ↓Top valid resultsQdrant filter-aware retrievalQuery ↓Embedding+Payload Filter ↓Qdrant retrieval ↓Semantically ranked valid propertiesMy benchmark contains 10 queries split across broad, moderate and selective filters.For example:Q07bedrooms = 3AND price AND locality = Hauz KhasQ09within 1 km of Hauz Khas MetroAND price Q10bedrooms = 3AND price AND locality = Hauz KhasAND covered_parking = trueThe benchmark records:latency_post_mslatency_pre_msvalid_postvalid_preand writes the results to:data/benchmark_results.csvThe experiment is intentionally small — 120 synthetic listings — so I treat it as a demonstration of the retrieval mechanics, not as a production-scale performance claim.14. Natural Language → Structured RetrievalThis is where the project becomes an AI application rather than just a Qdrant demo.The user says:“3BHK near Hauz Khas metro under 2 crore with covered parking.”The parser converts that into:StructuredQuery( semantic_query=text.strip(), price_max=20_000_000, bedrooms=3, locality="Hauz Khas", covered_parking=True, metro_station="Hauz Khas", radius_km=2.0,)The rule-based parser handles things like:bhk_match = re.search( r"(\d+)\s*bhk", lower)crore_match = re.search( r"(\d+(?:\.\d+)?)\s*crore", lower)sqft_match = re.search( r"(\d+)\s*sqft", lower)It also searches the known locality and metro lists.For example:for loc in sorted(_LOCALITIES, key=len, reverse=True): if loc.lower() in lower: locality = loc breakAnd:within_match = re.search( r"within\s+([\d]+(?:\.\d+)?)\s*km", lower)if within_match: radius_km = float(within_match.group(1))All of this eventually becomes structured data rather than trying to make the vector model understand exact numeric constraints.15. Optional LLM ParsingI also added an LLM path.If an API key is available, the parser asks gpt-4o-mini to return structured JSON containing:bedroomsprice_maxprice_minarea_minlocalitycovered_parkingmetro_stationradius_kmThe code then validates those fields before using them.And if the LLM fails?It falls back to the rule-based parser:except Exception as e: fallback = _parse_rules(text) fallback.warnings.insert( 0, f"LLM parsing failed, falling back to rule-based: {e}" ) return fallbackThat’s an important architectural decision.The LLM interprets the user’s request. Qdrant enforces the constraints.I don’t want an LLM deciding whether ₹2.7 crore is “close enough” to ₹2.5 crore.That’s the database’s job.16. The Final ArchitectureSo the complete system becomes:The UI lets the user enter natural language while also providing controls for budget, bedrooms, area, locality, parking and metro distance.It can display the parsed query as JSON, making the pipeline much less of a black box.17. What I Actually LearnedThe biggest takeaway from this project wasn’t:“Qdrant has good filtering.”It was something much more fundamental.A user’s query contains different kinds of information.Some parts are fuzzy:quietpeacefulfamily-friendlygood for working from homeSome parts aren’t fuzzy at all:3 bedroomsunder ₹2.5 crore1,500+ sqftcovered parkingwithin 2 kmTrying to represent both using one vector is where things start breaking.The better architecture is:Natural Language ↓Intent Understanding ↓Semantic Query + Structured Constraints ↓Filter-Aware Vector Retrieval ↓Ranking ↓ResultsAnd that’s why Qdrant fits this project so well.It let me keep the semantic representation and structured property information together, while allowing the retrieval query to enforce the constraints.ConclusionI started this project thinking I was building a vector search system. I ended up building something that made me think much more about retrieval systems. Because the real challenge isn’t finding something similar.It’s finding something similar that is actually valid.A property costing ₹3 crore can be a perfect semantic match for someone asking for a peaceful 3BHK with a home office. But if the budget is ₹2.5 crore, it shouldn’t appear.That’s the difference between a search demo and a useful search system. Vector embeddings give us semantic understanding. Payload filtering gives us structured constraints. Geographic filters give us actual distance.Boolean filters let us represent more realistic preferences.The query parser translates natural language into something the retrieval layer can enforce.And Qdrant brings these pieces together in one retrieval system.The progression is therefore not simply:Text → Embedding → Nearest NeighboursIt is:Text ↓Intent ↓Semantic Representation+Structured Constraints ↓Filter-Aware Retrieval ↓Semantic Ranking ↓ResultsNot when they simply tell us what is similar.But when they help us find what is relevant within the exact universe of things the user is actually looking for.That was the real problem I wanted to solve with this project.ReferencesQdrant Documentation — FilteringQdrant Documentation — SearchQdrant Documentation — Local QuickstartSentence Transformers — all-MiniLM-L6-v2Project Repository — AI Property Search with QdrantReference Article — Dense and Sparse Vector Search: I Combined Dense and Sparse Vectors to Search Medical ResearchWhy Vector Search Alone Isn’t Enough: Building AI Property Search with Advanced Filtering was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.