Skip to content

Commit

Permalink
Fix search stats query op (#858)
Browse files Browse the repository at this point in the history
* Fix search stats query op

* Linting

* More query op fixes

* Linting
  • Loading branch information
munrojm authored Oct 13, 2023
1 parent 5d05a93 commit e05aec3
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions emmet-api/emmet/api/routes/materials/summary/query_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,6 @@ def query(
100, title="The number of values in the returned distribution."
),
) -> STORE_PARAMS:
self.num_points = num_points
self.min_val = min_val
self.max_val = max_val

if min_val or max_val:
pipeline = [{"$match": {field: {}}}] # type: list
if min_val is not None:
Expand All @@ -268,9 +264,15 @@ def post_process(self, docs, query):
if docs:
field = list(docs[0].keys())[0]

num_points = self.num_points
min_val = self.min_val
max_val = self.max_val
params = query.get("pipeline", {})[0].get("$match", {})

for entry in params.values():
if "$gte" in entry:
min_val = entry.get("$gte", None)
max_val = entry.get("$lte", None)

num_points = 100

num_samples = len(docs)
warnings = []

Expand Down

0 comments on commit e05aec3

Please sign in to comment.