Skip to content
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

Is it possible to add a reindex api for git hooks? #113

Closed
aki-colt opened this issue Dec 5, 2024 · 5 comments
Closed

Is it possible to add a reindex api for git hooks? #113

aki-colt opened this issue Dec 5, 2024 · 5 comments
Labels
question Further information is requested

Comments

@aki-colt
Copy link

aki-colt commented Dec 5, 2024

Notice that the index could be only reindexed while restart. Could it be possible to add a reindex api for git hooks to reindex when new commit or new branch is added?

@brendan-kellam brendan-kellam added enhancement New feature or request question Further information is requested and removed enhancement New feature or request labels Dec 9, 2024
@brendan-kellam
Copy link
Contributor

Heya - there is no reindexing api atm, but could be an interesting addition to include with #101. Currently, reindexing happens once per hour. What is your use case? Is it often you want to search on new commits / branches as soon as they are pushed to the remote?

Also, what code host are you using? Assuming it has webhook support, I wonder if #57 would be preferred for this use case instead of using git hooks.

@aki-colt
Copy link
Author

Yes, what I mentioned is similar to #57, my fault that didn't notice that. I am in a special condition that I use gitlab to host not code but some docs which need to be version controlled and also need to be searched. Since there is a need to search in real time so I care about real time reindexing. I think an api for reindex is not difficult to implement after a quick browse to source code, but my concern is whether there is a performance issue in the index engine with frequent reindexing due to frequent commits.

@brendan-kellam
Copy link
Contributor

Are you using Sourcebot on your local machine? If so, one work-around that you could try is to use local indexing with the watch-mode enabled. Any changes made within the specified path will be re-indexed automatically:

{
    "$schema": "./schemas/v2/index.json",
    "repos": [
        {
            "type": "local",
            "path": "/path/to/my/repo",
            "watch": true
        }
    ]
}

If not local, then yea we will either need a webhook support or a REST api.

In terms of performance issues, I think that would depend on the frequency at which a re-indexing occurs and the size of the repo that is being indexed.. so best bet will be to for us to benchmark, see where the limits are, and go from there.

@aki-colt
Copy link
Author

Thanks very much for the help. I am going on a test on if there is a performance issue.

@brendan-kellam
Copy link
Contributor

Sounds good - let me know if you run into any issues for it. Going to close this issue for now, but please feel free to re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants