Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kiwionly/gitlabsearch

Simple java gitlab client that could search across gitlab projects content
https://github.com/kiwionly/gitlabsearch

free fulltext-search gitlab java search

Last synced: 26 days ago
JSON representation

Simple java gitlab client that could search across gitlab projects content

Awesome Lists containing this project

README

        

# GitLabSearch
Simple java gitlab client that could search across gitlab projects content, compatible with JDK 8 and above.

You can use it as library or command.

### library

#### Gradle

```groovy
implementation 'io.github.kiwionly:gitlab-search:1.1.1'
```

#### Maven

```xml

io.github.kiwionly
gitlab-search
1.1.1

```

### Command

You could run as jar or compile to native image ( GitLabSearch.exe ) and run as command :

Here is an example of search projects by name:

```sh
go-gitlabsearch projects -p -q -v -u -t
```

or ids

```sh
go-gitlabsearch projects -i -q -v -u -t
```

Or you could search projects by groups:
```sh
go-gitlabsearch groups -g -q -v -u -t
```

After specific the url and token and run for the first time, it will store in `.gitlab-search` file and will retrieve the url and token in future when running again the command.

Search by groups:

```sh
gitlab-search groups -g -q -v
```

### Compile to native image ( become .exe file ) using Graalvm

Install GraalVM and Visual studio on the build machine, select C++ development tool and Windows SDK when install Visual Studio.

After Visual Studio installed, open command prompt at root directory, run commands below, the first command is to set up build environment,
the Directory might be difference depend on the Visual Studio version you installed.

```cmd
> "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64"
> set JAVA_HOME=C:\graalvm-community-openjdk-20.0.1+9.1
> gradlew clean nativeCompile
```

### Library usage :

Sample usage as below:

```
String url = ""; // your domain url
String token = ""; // your gitlab token

GitLabSearch searcher = new GitLabSearch(url, token, 30); // use longer timeout for larger repository
searcher.setVerbose(true); // verbose search info for each project, default true
searcher.setPoolSize(10); // set before call search method, default 10,

String query = "my search query"; // case insensitive

// List list = searcher.searchByGroupIds(List.of(123L, 456L), query);
List list = searcher.searchWithKeyword("myproject", query);

// print search result
for (SearchResult res : list) {
System.out.printf("project : %s\n", res.getName());
System.out.printf("url : %s\n", res.getUrl());
System.out.printf("data : %s\n", res.getData());

System.out.println();
}
```