-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix issues indexer document mapping #25619
Conversation
Does this migrate the existing index or does it reindex everything? |
It will reindex everything. We have no way to migrate indexes, either bleve or es. |
I was unable to create a backport for 1.20. @wolfogre, please send one manually. 🍵
|
* giteaofficial/main: (22 commits) [skip ci] Updated translations via Crowdin Replace `interface{}` with `any` (go-gitea#25686) Several fixes for mobile UI (go-gitea#25634) Add elapsed time on debug for slow git commands (go-gitea#25642) some less naked returns (go-gitea#25682) Prevent duplicate image loading (go-gitea#25675) Add unit test for `HashAvatar` (go-gitea#25662) Fix the nil pointer when assigning issues to projects (go-gitea#25665) Actions list enhancements (go-gitea#25601) Fix issues indexer document mapping (go-gitea#25619) Fix show more for image on diff page (go-gitea#25672) Prevent SVG shrinking (go-gitea#25652) Log the real reason when authentication fails (but don't show the user) (go-gitea#25414) Add unit test for repository collaboration (go-gitea#25640) Fix UI misalignment on user setting page (go-gitea#25629) [skip ci] Updated translations via Crowdin Correct translation wrong format (go-gitea#25643) Add direct serving of package content (go-gitea#25543) Fix bug when change user name (go-gitea#25637) Make "cancel" buttons have proper type in modal forms (go-gitea#25618) ...
Since this PR is based on #25174 which is a refactor and hasn't been backported to v1.20, so it's difficult to backport this one. So I think it's OK to leave the old code in v1.20. |
Fix regression of #5363 (so long ago).
The old code definded a document mapping for
issueIndexerDocType
, and assigned it toBleveIndexerData
as its type. (BleveIndexerData
has been renamed toIndexerData
in #25174, but nothing more.) But the old code never usedBleveIndexerData
, it wrote the index with an anonymous struct type. Nonetheless, bleve would use the default auto-mapping for struct it didn't know, so the indexer still worked. This means the custom document mapping was always dead code.The custom document mapping is not useless, it can reduce index storage, this PR brings it back and disable default mapping to prevent it from happening again. Since
IndexerData
(BleveIndexerData
) has JSON tags, and bleve uses them first, so we should userepo_id
as the field name instead ofRepoID
.I did a test to compare the storage size before and after this, with about 3k real comments that were migrated from some public repos.
Before:
After:
It saves about half the storage space.