mirror of
https://github.com/go-gitea/gitea.git
synced 2026-06-27 02:02:48 +02:00
review: addressing review comments
This commit is contained in:
parent
305e07aad1
commit
51efef1a33
@ -16,7 +16,7 @@ import (
|
||||
"gitea.dev/modules/util"
|
||||
)
|
||||
|
||||
const issueIndexerLatestVersion = 4
|
||||
const issueIndexerLatestVersion = 3
|
||||
|
||||
var _ internal.Indexer = &Indexer{}
|
||||
|
||||
@ -58,7 +58,6 @@ const (
|
||||
"no_project": { "type": "boolean", "index": true },
|
||||
"poster_id": { "type": "integer", "index": true },
|
||||
"assignee_id": { "type": "integer", "index": true },
|
||||
"assignee_ids": { "type": "integer", "index": true },
|
||||
"mention_ids": { "type": "integer", "index": true },
|
||||
"reviewed_ids": { "type": "integer", "index": true },
|
||||
"review_requested_ids": { "type": "integer", "index": true },
|
||||
@ -180,22 +179,11 @@ func (b *Indexer) Search(ctx context.Context, options *internal.SearchOptions) (
|
||||
|
||||
if options.AssigneeID != "" {
|
||||
if options.AssigneeID == "(any)" {
|
||||
query.Must(es.NewBoolQuery().Should(
|
||||
es.NewRangeQuery("assignee_id").Gte(1),
|
||||
es.NewRangeQuery("assignee_ids").Gte(1),
|
||||
))
|
||||
query.Must(es.NewRangeQuery("assignee_id").Gte(1))
|
||||
} else {
|
||||
// "(none)" becomes 0, it means no assignee
|
||||
assigneeIDInt64, _ := strconv.ParseInt(options.AssigneeID, 10, 64)
|
||||
if options.AssigneeID == "(none)" {
|
||||
query.Must(es.TermQuery("assignee_id", assigneeIDInt64)).
|
||||
MustNot(es.NewRangeQuery("assignee_ids").Gte(1))
|
||||
} else {
|
||||
query.Must(es.NewBoolQuery().Should(
|
||||
es.TermQuery("assignee_id", assigneeIDInt64),
|
||||
es.TermQuery("assignee_ids", assigneeIDInt64),
|
||||
))
|
||||
}
|
||||
query.Must(es.TermQuery("assignee_id", assigneeIDInt64))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
issueIndexerLatestVersion = 6
|
||||
issueIndexerLatestVersion = 5
|
||||
|
||||
// TODO: make this configurable if necessary
|
||||
maxTotalHits = 10000
|
||||
@ -75,7 +75,6 @@ func NewIndexer(url, apiKey, indexerName string) *Indexer {
|
||||
"no_project",
|
||||
"poster_id",
|
||||
"assignee_id",
|
||||
"assignee_ids",
|
||||
"mention_ids",
|
||||
"reviewed_ids",
|
||||
"review_requested_ids",
|
||||
@ -198,20 +197,11 @@ func (b *Indexer) Search(ctx context.Context, options *internal.SearchOptions) (
|
||||
|
||||
if options.AssigneeID != "" {
|
||||
if options.AssigneeID == "(any)" {
|
||||
query.And((&inner_meilisearch.FilterOr{}).
|
||||
Or(inner_meilisearch.NewFilterGte("assignee_id", 1)).
|
||||
Or(inner_meilisearch.NewFilterGte("assignee_ids", 1)))
|
||||
query.And(inner_meilisearch.NewFilterGte("assignee_id", 1))
|
||||
} else {
|
||||
// "(none)" becomes 0, it means no assignee
|
||||
assigneeIDInt64, _ := strconv.ParseInt(options.AssigneeID, 10, 64)
|
||||
if options.AssigneeID == "(none)" {
|
||||
query.And(inner_meilisearch.NewFilterEq("assignee_id", assigneeIDInt64)).
|
||||
And(inner_meilisearch.NewFilterNot(inner_meilisearch.NewFilterGte("assignee_ids", 1)))
|
||||
} else {
|
||||
query.And((&inner_meilisearch.FilterOr{}).
|
||||
Or(inner_meilisearch.NewFilterEq("assignee_id", assigneeIDInt64)).
|
||||
Or(inner_meilisearch.NewFilterEq("assignee_ids", assigneeIDInt64)))
|
||||
}
|
||||
query.And(inner_meilisearch.NewFilterEq("assignee_id", assigneeIDInt64))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user