Skip to content

Commit

Permalink
Improve search results for multikey indexes in group datasets (#5208)
Browse files Browse the repository at this point in the history
* don't filter slice for distinct scans

* update lightning group test
  • Loading branch information
benjaminpkane authored Dec 3, 2024
1 parent cea9b9a commit 0e3fa78
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions fiftyone/server/lightning.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ async def _do_async_query(
):
if isinstance(query, DistinctQuery):
if query.has_list:
return await _do_distinct_query(collection, query, filter)
return await _do_distinct_query(collection, query)

return await _do_distinct_pipeline(dataset, collection, query, filter)

Expand All @@ -343,14 +343,13 @@ async def _do_async_query(
async def _do_distinct_query(
collection: AsyncIOMotorCollection,
query: DistinctQuery,
filter: t.Optional[t.Mapping[str, str]],
):
match = None
if query.search:
match = query.search

try:
result = await collection.distinct(query.path, filter)
result = await collection.distinct(query.path)
except:
# too many results
return None
Expand Down
4 changes: 2 additions & 2 deletions tests/unittests/lightning_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ async def test_group_dataset(self, dataset: fo.Dataset):
},
{
"path": "classifications.classifications.label",
"values": ["one"],
"values": ["one", "two"],
},
{"path": "numeric", "min": 1.0, "max": 1.0},
{"path": "string", "values": ["one"]},
Expand Down Expand Up @@ -1164,7 +1164,7 @@ async def test_group_dataset(self, dataset: fo.Dataset):
},
{
"path": "classifications.classifications.label",
"values": ["two"],
"values": ["one", "two"],
},
{"path": "numeric", "min": 2.0, "max": 2.0},
{"path": "string", "values": ["two"]},
Expand Down

0 comments on commit 0e3fa78

Please sign in to comment.