You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
forgejo/modules
Jason Song 1e76a824bc
Refactor and enhance issue indexer to support both searching, filtering and paging (#26012)
Fix #24662.

Replace #24822 and #25708 (although it has been merged)


## Background

In the past, Gitea supported issue searching with a keyword and
conditions in a less efficient way. It worked by searching for issues
with the keyword and obtaining limited IDs (as it is heavy to get all)
on the indexer (bleve/elasticsearch/meilisearch), and then querying with
conditions on the database to find a subset of the found IDs. This is
why the results could be incomplete.

To solve this issue, we need to store all fields that could be used as
conditions in the indexer and support both keyword and additional
conditions when searching with the indexer.

## Major changes

- Redefine `IndexerData` to include all fields that could be used as
filter conditions.
- Refactor `Search(ctx context.Context, kw string, repoIDs []int64,
limit, start int, state string)` to `Search(ctx context.Context, options
*SearchOptions)`, so it supports more conditions now.
- Change the data type stored in `issueIndexerQueue`. Use
`IndexerMetadata` instead of `IndexerData` in case the data has been
updated while it is in the queue. This also reduces the storage size of
the queue.
- Enhance searching with Bleve/Elasticsearch/Meilisearch, make them
fully support `SearchOptions`. Also, update the data versions.
- Keep most logic of database indexer, but remove
`issues.SearchIssueIDsByKeyword` in `models` to avoid confusion where is
the entry point to search issues.
- Start a Meilisearch instance to test it in unit tests.
- Add unit tests with almost full coverage to test
Bleve/Elasticsearch/Meilisearch indexer.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
12 months ago
..
actions Fix `ref` for workflows triggered by `pull_request_target` (#25743) 1 year ago
activitypub Update tool dependencies, lock govulncheck and actionlint (#25655) 1 year ago
analyze Implement FSFE REUSE for golang files (#21840) 2 years ago
assetfs Skip unuseful error message in dev mode when watching local filesystem (#25919) 1 year ago
auth Use a general approach to access custom/static/builtin assets (#24022) 1 year ago
avatar Remove nfnt/resize and oliamb/cutter (#25999) 1 year ago
base Replace `interface{}` with `any` (#25686) 1 year ago
cache improve unit test for caching (#26185) 1 year ago
charset Replace `interface{}` with `any` (#25686) 1 year ago
container Implement FSFE REUSE for golang files (#21840) 2 years ago
context Show branches and tags that contain a commit (#25180) 1 year ago
csv Refactor locale number (#24134) 1 year ago
doctor Upgrade go dependencies (#25819) 1 year ago
emoji Update emoji set to Unicode 15 (#25595) 1 year ago
eventsource Less naked returns (#25713) 1 year ago
generate Bump github.com/golang-jwt/jwt to v5 (#25975) 1 year ago
git Show branches and tags that contain a commit (#25180) 1 year ago
gitgraph Add context cache as a request level cache (#22294) 1 year ago
graceful Allow the use of alternative net.Listener implementations by downstreams (#25855) 1 year ago
hcaptcha Consume hcaptcha and pwn deps (#22610) 1 year ago
highlight Upgrade go dependencies (#25819) 1 year ago
hostmatcher Implement FSFE REUSE for golang files (#21840) 2 years ago
html Replace `interface{}` with `any` (#25686) 1 year ago
httpcache Less naked returns (#25713) 1 year ago
httplib Less naked returns (#25713) 1 year ago
indexer Refactor and enhance issue indexer to support both searching, filtering and paging (#26012) 12 months ago
issue/template Replace `interface{}` with `any` (#25686) 1 year ago
json Replace `interface{}` with `any` (#25686) 1 year ago
label Make label templates have consistent behavior and priority (#23749) 1 year ago
lfs Rewrite logger system (#24726) 1 year ago
log Use stderr as fallback if the log file can't be opened (#26074) 1 year ago
markup Render plaintext task list items for markdown files (#26186) 1 year ago
mcaptcha Implement FSFE REUSE for golang files (#21840) 2 years ago
metrics Use a separate admin page to show global stats, remove `actions` stat (#25062) 1 year ago
migration Replace `interface{}` with `any` (#25686) 1 year ago
mirror Improve queue and logger context (#24924) 1 year ago
nosql Update tool dependencies, lock govulncheck and actionlint (#25655) 1 year ago
notification Refactor and enhance issue indexer to support both searching, filtering and paging (#26012) 12 months ago
options Use a general approach to access custom/static/builtin assets (#24022) 1 year ago
packages Fix typo in metadata (#26207) 12 months ago
paginator Use more specific test methods (#24265) 1 year ago
pprof Implement FSFE REUSE for golang files (#21840) 2 years ago
private Replace `interface{}` with `any` (#25686) 1 year ago
process Less naked returns (#25713) 1 year ago
proxy Use proxy for pull mirror (#22771) 1 year ago
proxyprotocol Implement FSFE REUSE for golang files (#21840) 2 years ago
public Serve pre-defined files in "public", add "security.txt", add CORS header for ".well-known" (#25974) 1 year ago
queue Calculate MAX_WORKERS default value by CPU number (#26177) 1 year ago
recaptcha Implement FSFE REUSE for golang files (#21840) 2 years ago
references Use correct captured group range when parsing cross-reference (#22672) 1 year ago
regexplru Upgrade go dependencies (#25819) 1 year ago
repository Refactor and enhance issue indexer to support both searching, filtering and paging (#26012) 12 months ago
secret Improve decryption failure message (#24573) 1 year ago
session Replace `interface{}` with `any` (#25686) 1 year ago
setting Fix allowed user types setting problem (#26200) 12 months ago
sitemap Fix sitemap (#22272) 2 years ago
ssh Refactor path & config system (#25330) 1 year ago
storage Replace `interface{}` with `any` (#25686) 1 year ago
structs Doc update swagger doc for POST /orgs/{org}/teams (#26155) 1 year ago
svg Move public asset files to the proper directory (#25907) 1 year ago
sync Implement FSFE REUSE for golang files (#21840) 2 years ago
system Implement FSFE REUSE for golang files (#21840) 2 years ago
templates Replace `interface{}` with `any` (#25686) 1 year ago
test Replace `interface{}` with `any` (#25686) 1 year ago
testlogger Replace `interface{}` with `any` (#25686) 1 year ago
timeutil Fix incorrect webhook time and use relative-time to display it (#24477) 1 year ago
translation Replace `interface{}` with `any` (#25686) 1 year ago
turnstile Add new captcha: cloudflare turnstile (#22369) 1 year ago
typesniffer Do not recognize text files as audio (#23355) 1 year ago
updatechecker Implement FSFE REUSE for golang files (#21840) 2 years ago
upload Implement FSFE REUSE for golang files (#21840) 2 years ago
uri Implement FSFE REUSE for golang files (#21840) 2 years ago
user Implement FSFE REUSE for golang files (#21840) 2 years ago
util Less naked returns (#25713) 1 year ago
validation Replace `interface{}` with `any` (#25686) 1 year ago
web Fix incorrect router logger (#26137) 1 year ago
webhook New webhook trigger for receiving Pull Request review requests (#24481) 1 year ago