Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve search results for multikey indexes in group datasets #5208

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading