Skip to content

Commit 17b2c90

Browse files
committed
init
0 parents  commit 17b2c90

File tree

16 files changed

+4256
-0
lines changed

16 files changed

+4256
-0
lines changed

.github/workflows/ci.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
go-version: ['1.21', '1.22', '1.23']
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v4
22+
with:
23+
go-version: ${{ matrix.go-version }}
24+
25+
- name: Cache Go modules
26+
uses: actions/cache@v3
27+
with:
28+
path: ~/go/pkg/mod
29+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
30+
restore-keys: |
31+
${{ runner.os }}-go-
32+
33+
- name: Verify dependencies
34+
run: go mod verify
35+
36+
- name: Build
37+
run: go build -v ./...
38+
39+
- name: Run tests
40+
run: go test -v -race -coverprofile=coverage.out ./...
41+
42+
- name: Generate coverage report
43+
run: go tool cover -html=coverage.out -o coverage.html
44+
45+
- name: Upload coverage reports to Codecov
46+
uses: codecov/codecov-action@v3
47+
with:
48+
file: ./coverage.out
49+
fail_ci_if_error: false
50+
51+
lint:
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Checkout code
55+
uses: actions/checkout@v4
56+
57+
- name: Set up Go
58+
uses: actions/setup-go@v4
59+
with:
60+
go-version: '1.23'
61+
62+
- name: golangci-lint
63+
uses: golangci/golangci-lint-action@v3
64+
with:
65+
version: latest
66+
args: --timeout=5m
67+
68+
security:
69+
runs-on: ubuntu-latest
70+
steps:
71+
- name: Checkout code
72+
uses: actions/checkout@v4
73+
74+
- name: Set up Go
75+
uses: actions/setup-go@v4
76+
with:
77+
go-version: '1.23'
78+
79+
- name: Run Gosec Security Scanner
80+
uses: securecodewarrior/github-action-gosec@master
81+
with:
82+
args: './...'

.gitignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Binaries
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, built with `go test -c`
9+
*.test
10+
11+
# Output of the go coverage tool
12+
*.out
13+
14+
# Dependency directories
15+
vendor/
16+
17+
# Go workspace file
18+
go.work
19+
20+
# IDE files
21+
.vscode/
22+
.idea/
23+
.cursor/
24+
.claude/
25+
*.swp
26+
*.swo
27+
28+
# OS files
29+
.DS_Store
30+
Thumbs.db

CHANGELOG.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [1.0.0] - 2025-01-24
9+
10+
### Initial Release
11+
12+
#### Added
13+
- **Core Query Builder** - Fluent API for constructing Vespa YQL queries
14+
- **Type-Safe Field Operations** - Builder pattern for field conditions with compile-time safety
15+
- **Comprehensive Operators** - Support for all major comparison, collection, and text operators
16+
- **Vector Search Support** - First-class support for `nearestNeighbor` operations in WHERE clauses and rank expressions
17+
- **Boolean Logic** - Full support for AND, OR, and NOT combinations with proper precedence
18+
- **Range Conditions** - Convenient `Between()` method for numeric and date ranges
19+
- **SameElement Conditions** - Support for complex array/struct querying with `ContainsSameElement()`
20+
- **Rank Expressions** - Flexible ranking with vector search, text matching, and custom expressions
21+
- **Functional Options** - Extensible configuration using functional options pattern
22+
- **UserQuery Support** - Integration with Vespa's `userQuery()` function for text search
23+
- **Pagination Support** - Built-in support for result pagination with `WithOffset()` and `WithHits()`
24+
25+
#### Features
26+
27+
##### Query Building
28+
- Fluent API with method chaining
29+
- Type-safe field operations
30+
- Comprehensive validation with detailed error messages
31+
- Support for all Vespa YQL operators
32+
33+
##### Vector Search
34+
- `NearestNeighbor` conditions in WHERE clauses
35+
- Configurable parameters: label, distance threshold, approximate search
36+
- Multi-vector search scenarios in rank expressions
37+
- Support for both approximate and exact vector search
38+
39+
##### Text Search
40+
- Multiple text matching types: exact, phrase, fuzzy
41+
- Integration with `userQuery()` for flexible text search
42+
- Support for custom default indexes
43+
44+
##### Boolean Logic
45+
- Nested AND/OR/NOT combinations
46+
- XOR patterns using NOT with AND/OR
47+
- Proper parenthesis generation for complex logic
48+
49+
##### Complex Data Structures
50+
- `sameElement` support for arrays of structs/maps
51+
- Proper handling of Vespa's sameElement limitations
52+
- Workarounds for IN/OR restrictions within sameElement
53+
54+
##### Developer Experience
55+
- Extensive documentation with examples
56+
- Comprehensive test coverage (95%+)
57+
- Real-world usage examples
58+
- Clear error messages and validation
59+
60+
#### Technical Details
61+
- **Language**: Go 1.21+
62+
- **Dependencies**: Zero external dependencies (standard library only)
63+
- **Testing**: Comprehensive test suite with edge cases
64+
- **Documentation**: Extensive README with examples and best practices
65+
66+
#### Supported Vespa Features
67+
- All YQL operators and functions
68+
- Vector search with HNSW indexes
69+
- Text search and ranking
70+
- Complex field structures
71+
- Pagination
72+
- Custom ranking expressions
73+
- Input parameters for vectors and other data
74+
75+
---
76+
77+
## Contributing
78+
79+
When contributing to this project, please:
80+
1. Update the CHANGELOG.md with your changes
81+
2. Follow semantic versioning for version bumps
82+
3. Include tests for new features
83+
4. Update documentation as needed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Vipul Sodha
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)