fix(indexer): fix assignee filters in issue search - #38021
Conversation
| // "(none)" becomes 0, it means no assignee | ||
| assigneeIDInt64, _ := strconv.ParseInt(options.AssigneeID, 10, 64) | ||
| queries = append(queries, inner_bleve.NumericEqualityQuery(assigneeIDInt64, "assignee_id")) | ||
| if options.AssigneeID == "(none)" { |
There was a problem hiding this comment.
Above you parse the assigneeid to int why again a str comp here?
There was a problem hiding this comment.
The code only queries assignee_id == 0 when looking for unassigned issues:
if options.AssigneeID == "(none)" {
queries = append(queries, inner_bleve.NumericEqualityQuery(assigneeIDInt64, "assignee_id"))
However, an issue is truly unassigned only if both assignee_id and assignee_ids are empty. If assignee_ids contains entries, the
issue has assignees. The current logic won't catch such cases.
There was a problem hiding this comment.
I hope new change will fine.
|
And it's better to have a new field named |
|
|
@lunny Shall I make any change in this PR. |
There was a problem hiding this comment.
Pull request overview
This PR fixes “Assigned to you” keyword searches (notably for Bleve) by indexing the full set of issue assignees from issue_assignees and updating all issue indexer backends to filter using assignee_ids plus a no_assignee boolean.
Changes:
- Replace single
assignee_idindexing withassignee_ids(multi-assignee aware) and addno_assigneeto support(any)/(none)filtering reliably. - Bump issue indexer schema versions for Bleve/Meilisearch/Elasticsearch and update their query logic accordingly.
- Update shared indexer backend tests and add a Bleve-specific regression test for
(any)/(none)/specific assignee filtering.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| modules/indexer/issues/util.go | Loads assignee IDs for IndexerData and sets NoAssignee for correct filtering. |
| modules/indexer/issues/internal/model.go | Changes indexed schema from AssigneeID to AssigneeIDs + NoAssignee. |
| modules/indexer/issues/bleve/bleve.go | Updates Bleve mappings/query logic to use assignee_ids and no_assignee; bumps index version. |
| modules/indexer/issues/meilisearch/meilisearch.go | Updates Meilisearch filterable fields/query logic and bumps index version. |
| modules/indexer/issues/elasticsearch/elasticsearch.go | Updates ES mappings/query logic and bumps index version. |
| modules/indexer/issues/internal/tests/tests.go | Updates backend-agnostic indexer test expectations/data generation for new assignee fields. |
| modules/indexer/issues/bleve/bleve_test.go | Adds targeted Bleve test covering (any)/(none)/specific assignee behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Backport if required? |
|
Since the indexer version will be upgraded, I don't think it should be backport. |
lunny
left a comment
There was a problem hiding this comment.
PR title and description needs to be updated.
Done |
fix(indexer): fix assignee filters in issue search (go-gitea#38021) Issue search filtering still relied on the legacy single-assignee field, so searches such as "Assigned to you" could miss issues when a keyword query was used. Index all issue assignee IDs and add an explicit no_assignee field so specific, any-assignee, and no-assignee filters work consistently across Bleve, Elasticsearch, and Meilisearch. Fixes go-gitea#36299.

fix(indexer): fix assignee filters in issue search (#38021)
Issue search filtering still relied on the legacy single-assignee field,
so searches such as "Assigned to you" could miss issues when a keyword
query was used.
Index all issue assignee IDs and add an explicit no_assignee field so
specific, any-assignee, and no-assignee filters work consistently across
Bleve, Elasticsearch, and Meilisearch.
Fixes #36299.