Skip to content

fix(indexer): fix assignee filters in issue search - #38021

Merged
bircni merged 30 commits into
go-gitea:mainfrom
puni9869:puni9869/ISSUE-36299
Jun 22, 2026
Merged

fix(indexer): fix assignee filters in issue search#38021
bircni merged 30 commits into
go-gitea:mainfrom
puni9869:puni9869/ISSUE-36299

Conversation

@puni9869

@puni9869 puni9869 commented Jun 7, 2026

Copy link
Copy Markdown
Member

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.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 7, 2026
Comment thread modules/indexer/issues/bleve/bleve.go Outdated
// "(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)" {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above you parse the assigneeid to int why again a str comp here?

@puni9869 puni9869 Jun 7, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In search options.AssigneeID there are three values: "(none)" or "(any)" or a user ID. There I went for explicit comparison.
image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope new change will fine.

@puni9869 puni9869 mentioned this pull request Jun 7, 2026
24 tasks
Comment thread modules/indexer/issues/bleve/bleve.go Outdated
Comment thread modules/indexer/issues/elasticsearch/elasticsearch.go Outdated
@lunny

lunny commented Jun 7, 2026

Copy link
Copy Markdown
Member

And it's better to have a new field named no_assignee as bool type

@puni9869

puni9869 commented Jun 9, 2026

Copy link
Copy Markdown
Member Author

And it's better to have a new field named no_assignee as bool type
Done

@puni9869

puni9869 commented Jun 9, 2026

Copy link
Copy Markdown
Member Author

@lunny Shall I make any change in this PR.

Comment thread modules/indexer/issues/bleve/bleve.go
Comment thread modules/indexer/issues/internal/model.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_id indexing with assignee_ids (multi-assignee aware) and add no_assignee to 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.

Comment thread modules/indexer/issues/util.go Outdated
@puni9869

Copy link
Copy Markdown
Member Author

Backport if required?

@lunny

lunny commented Jun 17, 2026

Copy link
Copy Markdown
Member

Since the indexer version will be upgraded, I don't think it should be backport.

@lunny lunny left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR title and description needs to be updated.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jun 17, 2026
@bircni
bircni requested a review from wxiaoguang June 17, 2026 20:51
@puni9869 puni9869 changed the title fix(indexer): load issue assignees from issue_assignees for bleve search fix(indexer): fix assignee filters in issue search (#38021) Jun 18, 2026
@puni9869

Copy link
Copy Markdown
Member Author

PR title and description needs to be updated.

Done

@bircni bircni changed the title fix(indexer): fix assignee filters in issue search (#38021) fix(indexer): fix assignee filters in issue search Jun 18, 2026
@puni9869
puni9869 requested a review from a team June 22, 2026 03:52
@bircni
bircni removed the request for review from wxiaoguang June 22, 2026 03:52
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 22, 2026
@bircni bircni added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jun 22, 2026
@bircni
bircni merged commit a4781dd into go-gitea:main Jun 22, 2026
26 checks passed
@GiteaBot GiteaBot added this to the 1.28.0 milestone Jun 22, 2026
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jun 22, 2026
@bircni bircni modified the milestones: 1.28.0, 1.27.0 Jun 22, 2026
zeekay pushed a commit to hanzoai/forge that referenced this pull request Jul 26, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Searching in "Assigned to you" issues returns no results unless query is empty

5 participants