diff --git a/yente/routers/reconcile.py b/yente/routers/reconcile.py index 20b58941..7308f563 100644 --- a/yente/routers/reconcile.py +++ b/yente/routers/reconcile.py @@ -183,8 +183,11 @@ async def reconcile_query( properties[prop.name].append(p.get("v")) example = EntityExample(id=None, schema=schema, properties=dict(properties)) - proxy = Entity.from_example(example) - query = entity_query(dataset, proxy, fuzzy=False, changed_since=changed_since) + try: + proxy = Entity.from_example(example) + query = entity_query(dataset, proxy, fuzzy=False, changed_since=changed_since) + except Exception as exc: + raise HTTPException(400, detail=str(exc)) resp = await search_entities(provider, query, limit=limit, offset=offset) algorithm_ = get_algorithm_by_name(algorithm) entities = result_entities(resp) diff --git a/yente/search/queries.py b/yente/search/queries.py index 7bc2fbe3..49d33c0d 100644 --- a/yente/search/queries.py +++ b/yente/search/queries.py @@ -106,6 +106,9 @@ def entity_query( exclude_dataset: List[str] = [], changed_since: Optional[str] = None, ) -> Clause: + if not entity.schema.matchable: + raise TypeError("Schema is not matchable: %s" % entity.schema.name) + shoulds: List[Clause] = names_query(entity, fuzzy=fuzzy) for prop, value in entity.itervalues(): if prop.type == registry.name or not prop.matchable: