Skip to content

Commit ae1c84f

Browse files
committed
fix: dev publishing pipeline
1 parent 72d1969 commit ae1c84f

2 files changed

Lines changed: 124 additions & 18 deletions

File tree

.github/workflows/snapshot.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,8 @@ jobs:
3434
mvn versions:set -DnewVersion="${VERSION}-SNAPSHOT" -DgenerateBackupPoms=false
3535
fi
3636
37-
- name: Build and test
38-
run: mvn -B clean verify
39-
40-
- name: Publish to GitHub Packages
41-
run: mvn -B deploy -DskipTests
37+
- name: Build, test and publish to GitHub Packages
38+
run: mvn -B clean deploy -Dmaven.resolver.transport=wagon
4239
env:
4340
GITHUB_ACTOR: ${{ github.actor }}
4441
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 122 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,14 @@ for (QueryResult item : results) {
189189

190190
**Query Parameters:**
191191

192-
| Parameter | Description | Default | Max |
193-
| ---------------- | ------------------------------------------------------- | -------- | ---- |
194-
| `vector` | Query vector (must match index dimension) | Required | - |
195-
| `topK` | Number of results to return | 10 | 512 |
196-
| `ef` | Search quality parameter - higher values improve recall | 128 | 1024 |
197-
| `includeVectors` | Include vector data in results | false | - |
192+
| Parameter | Description | Default | Max |
193+
| -------------------------------- | --------------------------------------------------------------------------- | ------- | --------- |
194+
| `vector` | Query vector (must match index dimension) | Required | - |
195+
| `topK` | Number of results to return | 10 | 512 |
196+
| `ef` | Search quality parameter - higher values improve recall | 128 | 1024 |
197+
| `includeVectors` | Include vector data in results | false | - |
198+
| `prefilterCardinalityThreshold` | Switch from prefilter to postfilter when estimated matches exceed this value | 10,000 | 1,000,000 |
199+
| `filterBoostPercentage` | Bias results toward filter matches (0 = no boost, 100 = maximum boost) | 0 | 100 |
198200

199201
## Filtered Querying
200202

@@ -223,6 +225,30 @@ List<QueryResult> results = index.query(
223225

224226
> **Note:** The `$range` operator supports values within **[0 - 999]**. Normalize larger values before upserting.
225227
228+
### Filter Performance Tuning
229+
230+
Two parameters control how filters are applied during search:
231+
232+
**`prefilterCardinalityThreshold`** — controls the cutover between prefiltering and postfiltering:
233+
- **Prefilter** (default for small result sets): filters are applied *before* the ANN search, scanning only matching vectors. Fast when the filter is selective.
234+
- **Postfilter**: the ANN search runs first, then results are filtered. Used when the estimated number of matches exceeds the threshold.
235+
236+
**`filterBoostPercentage`** — biases the ANN search toward vectors that match the filter (0–100). Higher values trade some recall for better filter alignment.
237+
238+
```java
239+
List<QueryResult> results = index.query(
240+
QueryOptions.builder()
241+
.vector(new double[] {0.15, 0.25 /* ... */})
242+
.topK(5)
243+
.filter(List.of(
244+
Map.of("category", Map.of("$eq", "tech"))
245+
))
246+
.prefilterCardinalityThreshold(50000) // switch to postfilter above 50k matches
247+
.filterBoostPercentage(20) // slight boost toward filter matches
248+
.build()
249+
);
250+
```
251+
226252
## Hybrid Search
227253

228254
### Upserting Hybrid Vectors
@@ -524,13 +550,15 @@ CreateIndexOptions.builder(String name, int dimension)
524550

525551
```java
526552
QueryOptions.builder()
527-
.vector(double[]) // Required for dense search
528-
.topK(int) // Required
529-
.ef(int) // Default: 128
530-
.filter(List<Map<String, Object>>) // Optional
531-
.includeVectors(boolean) // Default: false
532-
.sparseIndices(int[]) // Optional, for hybrid search
533-
.sparseValues(double[]) // Optional, for hybrid search
553+
.vector(double[]) // Required for dense search
554+
.topK(int) // Default: 10, Max: 512
555+
.ef(int) // Default: 128, Max: 1024
556+
.filter(List<Map<String, Object>>) // Optional
557+
.includeVectors(boolean) // Default: false
558+
.sparseIndices(int[]) // Optional, for hybrid search
559+
.sparseValues(double[]) // Optional, for hybrid search
560+
.prefilterCardinalityThreshold(int) // Default: 10000, range: 1000–1000000
561+
.filterBoostPercentage(int) // Default: 0, range: 0–100
534562
.build()
535563
```
536564

@@ -582,6 +610,87 @@ VectorItem.builder(String id, double[] vector)
582610
| `precision` | `Precision` | Quantization precision |
583611
| `m` | `int` | Graph connectivity |
584612

613+
## Publishing & Versioning
614+
615+
### Version Convention
616+
617+
The version in `pom.xml` always carries a `-SNAPSHOT` suffix during development (e.g., `0.1.2-SNAPSHOT`). The CI/CD pipeline handles stripping it for releases automatically — you never need to edit the version manually.
618+
619+
### Branching Strategy
620+
621+
| Branch | Action | Publishes To |
622+
| ------ | ------ | ------------ |
623+
| `dev` | Push / merge | GitHub Packages (`pkg.github.com`) as a SNAPSHOT |
624+
| `main` | Push / merge | Maven Central as a release + GitHub Release tag |
625+
626+
### Release Flow (main branch)
627+
628+
When code is pushed to `main`, GitHub Actions automatically:
629+
1. Strips `-SNAPSHOT` from the version (e.g., `0.1.2-SNAPSHOT``0.1.2`)
630+
2. Signs artifacts with GPG and deploys to Maven Central
631+
3. Creates a git tag `v0.1.2` and a GitHub Release
632+
4. Bumps the pom version to the next patch SNAPSHOT (`0.1.3-SNAPSHOT`) and commits back to `main`
633+
634+
### Snapshot Flow (dev branch)
635+
636+
When code is pushed to `dev`, GitHub Actions:
637+
1. Builds and runs all tests
638+
2. Publishes `0.1.2-SNAPSHOT` to GitHub Packages
639+
640+
> Sonatype Central Portal does **not** support SNAPSHOT versions, which is why snapshots go to GitHub Packages.
641+
642+
### Consuming a Snapshot
643+
644+
To use a snapshot version in another project, add the GitHub Packages repository and authenticate with a GitHub token that has `read:packages` scope:
645+
646+
```xml
647+
<repositories>
648+
<repository>
649+
<id>github</id>
650+
<url>https://maven.pkg.github.com/EndeeLabs/endee-java-client</url>
651+
</repository>
652+
</repositories>
653+
```
654+
655+
Add credentials in `~/.m2/settings.xml`:
656+
657+
```xml
658+
<server>
659+
<id>github</id>
660+
<username>YOUR_GITHUB_USERNAME</username>
661+
<password>YOUR_GITHUB_TOKEN</password>
662+
</server>
663+
```
664+
665+
Then depend on the snapshot:
666+
667+
```xml
668+
<dependency>
669+
<groupId>io.endee</groupId>
670+
<artifactId>endee-java-client</artifactId>
671+
<version>0.1.2-SNAPSHOT</version>
672+
</dependency>
673+
```
674+
675+
### Required GitHub Secrets
676+
677+
| Secret | Purpose |
678+
| ------ | ------- |
679+
| `CENTRAL_USERNAME` | Sonatype Central Portal username |
680+
| `CENTRAL_PASSWORD` | Sonatype Central Portal token |
681+
| `GPG_PRIVATE_KEY` | Armored GPG private key for signing |
682+
| `GPG_PASSPHRASE` | GPG key passphrase |
683+
684+
### Local Manual Deploy
685+
686+
```bash
687+
# Deploy a release to Maven Central (requires GPG installed)
688+
mvn clean deploy -Prelease
689+
690+
# Pass GPG passphrase inline if not in settings.xml
691+
mvn clean deploy -Prelease -Dgpg.passphrase="your-passphrase"
692+
```
693+
585694
## Dependencies
586695

587696
- Jackson (JSON serialization)

0 commit comments

Comments
 (0)