Add reindex trigger to repo settings #1698

Closed
opened 2025-11-02 04:10:03 -06:00 by GiteaMirror · 10 comments
Owner

Originally created by @mqudsi on GitHub (Apr 14, 2018).

In a perfect world it wouldn't be necessary, but there are bugs that cause the gitea db to become out of sync with the actual on-disk repo.

Please consider adding a "perform re-index operation" button to the repo settings, so that one can forcibly resync the UI with the repo. For example, I should be able to use it to correct the aftermath of #3795

Originally created by @mqudsi on GitHub (Apr 14, 2018). In a perfect world it wouldn't be necessary, but there are bugs that cause the gitea db to become out of sync with the actual on-disk repo. Please consider adding a "perform re-index operation" button to the repo settings, so that one can forcibly resync the UI with the repo. For example, I should be able to use it to correct the aftermath of #3795
GiteaMirror added the type/proposal label 2025-11-02 04:10:03 -06:00
Author
Owner

@mqudsi commented on GitHub (Aug 28, 2018):

Until this is resolved, can someone tell me how to manually force the reindexing?

@mqudsi commented on GitHub (Aug 28, 2018): Until this is resolved, can someone tell me how to manually force the reindexing?
Author
Owner

@lunny commented on GitHub (Aug 28, 2018):

@mqudsi check the code 801843b011/modules/indexer/indexer.go (L69)
I think it will be reindex when you

  1. stop gitea
  2. delete index data directory
  3. start gitea
@lunny commented on GitHub (Aug 28, 2018): @mqudsi check the code https://github.com/go-gitea/gitea/blob/801843b0115e29ba2304fa6a5bea1ae169a58e02/modules/indexer/indexer.go#L69 I think it will be reindex when you 1) stop gitea 2) delete index data directory 3) start gitea
Author
Owner

@mqudsi commented on GitHub (Feb 14, 2020):

@lunny are you talking about the bleve files in the various indexers directories? Those appear to specifically be full-text indices and don't result in the UI data being reloaded.

@mqudsi commented on GitHub (Feb 14, 2020): @lunny are you talking about the bleve files in the various `indexers` directories? Those appear to specifically be full-text indices and don't result in the UI data being reloaded.
Author
Owner

@jvrsantacruz commented on GitHub (Feb 19, 2020):

+1 I have an use case for having already existing repositories and being able to make gitea acknowledge them.

Those repositories follow the same structure as the repositories that gitea owns but are created/updated by a separated replication service.

@jvrsantacruz commented on GitHub (Feb 19, 2020): +1 I have an use case for having already existing repositories and being able to make gitea acknowledge them. Those repositories follow the same structure as the repositories that gitea owns but are created/updated by a separated replication service.
Author
Owner

@miccze commented on GitHub (Apr 9, 2021):

I'm also in need of button for reindex trigger. Restarting gitea helps partially, some terms are not being found in code search after restart.

@miccze commented on GitHub (Apr 9, 2021): I'm also in need of button for reindex trigger. Restarting gitea helps partially, some terms are not being found in code search after restart.
Author
Owner

@ForestJohnson commented on GitHub (Oct 30, 2021):

I want this too. Deleting the /data/gitea/indexers/repos.bleve folder and then restarting does seem to do something but still not all of my repos are indexed. Look here:

https://github.com/go-gitea/gitea/blob/main/modules/indexer/code/indexer.go#L318

pageSize = 50 hardcoded 👀

I'm not sure but it looks like it only ever indexes the 1st 50 repos it finds ?

This has to be an accidental bug right?

Please note there is also a trace log which we can use to watch the re-index process in theory:
https://github.com/go-gitea/gitea/blob/release/v1.15/modules/indexer/code/indexer.go#L148

I will post again if I ever figure out why its not indexing my repos.

@ForestJohnson commented on GitHub (Oct 30, 2021): I want this too. Deleting the `/data/gitea/indexers/repos.bleve` folder and then restarting does seem to do something but still not all of my repos are indexed. Look here: https://github.com/go-gitea/gitea/blob/main/modules/indexer/code/indexer.go#L318 pageSize = 50 hardcoded 👀 I'm not sure but it looks like it only ever indexes the 1st 50 repos it finds ? This has to be an accidental bug right? Please note there is also a trace log which we can use to watch the re-index process in theory: https://github.com/go-gitea/gitea/blob/release/v1.15/modules/indexer/code/indexer.go#L148 I will post again if I ever figure out why its not indexing my repos.
Author
Owner

@ForestJohnson commented on GitHub (Oct 30, 2021):

For now I was able to get it to re-index the repo I wanted simply by making a commit on that repo. But it would be nice if the re-index button was added to the admin panel, and also it would be nice if the re-index worked for all repos, not just some of them.

@ForestJohnson commented on GitHub (Oct 30, 2021): For now I was able to get it to re-index the repo I wanted simply by making a commit on that repo. But it would be nice if the re-index button was added to the admin panel, and also it would be nice if the re-index worked for all repos, not just some of them.
Author
Owner

@viceice commented on GitHub (Dec 8, 2021):

Would be nice to be able to force a full re-index via gitea cli.

currently struggling with this error:

Unable to initialize the elasticsearch Repository Indexer connstr: http://opensearch-master:9200 Error: elastic: Error 400 (Bad Request): Invalid alias name [gitea_codes], an index exists with the same name as the alias [type=invalid_alias_name_exception]
@viceice commented on GitHub (Dec 8, 2021): Would be nice to be able to force a full re-index via gitea cli. currently struggling with this error: ``` Unable to initialize the elasticsearch Repository Indexer connstr: http://opensearch-master:9200 Error: elastic: Error 400 (Bad Request): Invalid alias name [gitea_codes], an index exists with the same name as the alias [type=invalid_alias_name_exception] ```
Author
Owner

@ForestJohnson commented on GitHub (Dec 8, 2021):

ElasticSearch has an index alias feature which works sort of like an alias file on a computer (sometimes called a soft link). When an ElasticSearch client issues a search request to a cluster, it passes the name of the index it would like to search as a part of the request. That name must match either the name of an index or the name of an alias. You can't have two indexes with the same name, and you also can't have an alias with the same name as an index. Otherwise the ElasticSearch cluster wouldn't know which one you were trying to search; it's a unique ID.

In this case it looks like your elasticsearch cluster was previously set up (perhaps by a previous version of gitea??) to use an index called gitea_codes, but now gitea is trying to create a new alias with the same name gitea_codes, which is not allowed. It's like the same error when you try to sign up for a web site and they tell you

That username is already taken by another user

Maybe you should take a backup of whats in your elasticsearch right now and then completely reset it, delete all the indexes and aliases by hand.

@ForestJohnson commented on GitHub (Dec 8, 2021): ElasticSearch has an index alias feature which works sort of like an alias file on a computer (sometimes called a soft link). When an ElasticSearch client issues a search request to a cluster, it passes the name of the index it would like to search as a part of the request. That name must match either the name of an index or the name of an alias. You can't have two indexes with the same name, and you also can't have an alias with the same name as an index. Otherwise the ElasticSearch cluster wouldn't know which one you were trying to search; it's a unique ID. In this case it looks like your elasticsearch cluster was previously set up (perhaps by a previous version of gitea??) to use an index called `gitea_codes`, but now gitea is trying to create a new alias with the same name `gitea_codes`, which is not allowed. It's like the same error when you try to sign up for a web site and they tell you > That username is already taken by another user Maybe you should take a backup of whats in your elasticsearch right now and then completely reset it, delete all the indexes and aliases by hand.
Author
Owner

@viceice commented on GitHub (Dec 8, 2021):

@ForestJohnson Yes, I've manually deleted the three gitea indexes and restarted gitea. Now it's working fine again.

@viceice commented on GitHub (Dec 8, 2021): @ForestJohnson Yes, I've manually deleted the three gitea indexes and restarted gitea. Now it's working fine again.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1698