Configure search result boosting in GrepAI. Use this skill to prioritize certain paths and penalize others.
This skill covers configuring score boosting to prioritize relevant code paths and deprioritize tests, docs, and vendor code.
Boosting modifies search scores based on file paths:
Original score: 0.85 (src/auth.go)
Bonus (+10%): 0.935
Original score: 0.85 (tests/auth_test.go)
Penalty (-50%): 0.425
This ensures production code ranks higher than tests with similar content.
# .grepai/config.yaml
search:
boost:
enabled: true
penalties:
- pattern: /tests/
factor: 0.5
bonuses:
- pattern: /src/
factor: 1.1
search:
boost:
enabled: true
# Reduce scores (factor < 1.0)
penalties:
# Test files
- pattern: /tests/
factor: 0.5
- pattern: /__tests__/
factor: 0.5
- pattern: _test.
factor: 0.5
- pattern: .spec.
factor: 0.5
- pattern: .test.
factor: 0.5
# Documentation
- pattern: /docs/
factor: 0.6
- pattern: /documentation/
factor: 0.6
# Vendor/third-party
- pattern: /vendor/
factor: 0.3
- pattern: /node_modules/
factor: 0.3
- pattern: /third_party/
factor: 0.3
# Generated code
- pattern: /generated/
factor: 0.4
- pattern: .gen.
factor: 0.4
- pattern: .pb.go
factor: 0.4
# Examples and samples
- pattern: /examples/
factor: 0.7
- pattern: /samples/
factor: 0.7
# Increase scores (factor > 1.0)
bonuses:
# Core source code
- pattern: /src/
factor: 1.1
- pattern: /lib/
factor: 1.1
- pattern: /app/
factor: 1.1
- pattern: /core/
factor: 1.2
- pattern: /internal/
factor: 1.1
# Important directories
- pattern: /services/
factor: 1.1
- pattern: /handlers/
factor: 1.1
- pattern: /controllers/
factor: 1.1
| Factor | Effect | Use Case |
|---|---|---|
| 0.3 | 70% reduction | Strong penalty (vendor) |
| 0.5 | 50% reduction | Moderate penalty (tests) |
| 0.7 | 30% reduction | Mild penalty (examples) |
| 1.0 | No change | Neutral |
| 1.1 | 10% increase | Mild boost (src) |
| 1.2 | 20% increase | Moderate boost (core) |
| 1.5 | 50% increase | Strong boost |
Patterns match against the full file path:
/project/src/auth/middleware.go
^^^^
Matches "/src/" pattern
| Pattern | Matches | Doesn't Match |
|---|---|---|
/tests/ |
src/tests/auth.go |
tests.go |
_test. |
auth_test.go |
test_auth.go |
.spec. |
auth.spec.ts |
spec/auth.ts |
/src/ |
project/src/main.go |
resource/file.go |
Score: 0.85 | tests/auth_test.go:10-30
Score: 0.82 | src/auth/middleware.go:15-45
Score: 0.80 | src/auth/jwt.go:23-55
penalties:
- pattern: /tests/
factor: 0.5
bonuses:
- pattern: /src/
factor: 1.1
Score: 0.90 | src/auth/middleware.go:15-45 (0.82 Γ 1.1)
Score: 0.88 | src/auth/jwt.go:23-55 (0.80 Γ 1.1)
Score: 0.43 | tests/auth_test.go:10-30 (0.85 Γ 0.5)
search:
boost:
enabled: true
penalties:
- pattern: /tests/
factor: 0.5
- pattern: _test.
factor: 0.5
- pattern: .spec.
factor: 0.5
- pattern: /vendor/
factor: 0.3
- pattern: /docs/
factor: 0.6
bonuses:
- pattern: /src/
factor: 1.1
- pattern: /lib/
factor: 1.1
search:
boost:
enabled: true
penalties:
- pattern: /__tests__/
factor: 0.5
- pattern: .test.
factor: 0.5
- pattern: .spec.
factor: 0.5
- pattern: /node_modules/
factor: 0.3
- pattern: .stories.
factor: 0.6
- pattern: /storybook/
factor: 0.6
bonuses:
- pattern: /src/
factor: 1.1
- pattern: /components/
factor: 1.1
- pattern: /hooks/
factor: 1.1
search:
boost:
enabled: true
penalties:
- pattern: _test.go
factor: 0.5
- pattern: _mock.go
factor: 0.5
- pattern: /testdata/
factor: 0.5
- pattern: /vendor/
factor: 0.3
- pattern: .pb.go
factor: 0.4
bonuses:
- pattern: /internal/
factor: 1.1
- pattern: /cmd/
factor: 1.1
- pattern: /pkg/
factor: 1.1
search:
boost:
enabled: true
penalties:
- pattern: /tests/
factor: 0.5
- pattern: test_
factor: 0.5
- pattern: _test.py
factor: 0.5
- pattern: /conftest
factor: 0.5
- pattern: /fixtures/
factor: 0.6
bonuses:
- pattern: /src/
factor: 1.1
- pattern: /app/
factor: 1.1
- pattern: /core/
factor: 1.2
search:
boost:
enabled: true
penalties:
- pattern: /tests/
factor: 0.5
- pattern: _test.
factor: 0.5
- pattern: /packages/deprecated/
factor: 0.3
- pattern: /packages/legacy/
factor: 0.4
bonuses:
- pattern: /packages/core/
factor: 1.2
- pattern: /packages/api/
factor: 1.1
- pattern: /packages/shared/
factor: 1.1
To disable boosting entirely:
search:
boost:
enabled: false
Or remove the boost section from config.
| Approach | Effect | Use Case |
|---|---|---|
| Ignore | Completely excluded | Dependencies, build output |
| Penalty | Still searchable, lower rank | Tests, docs, examples |
| Neutral | Default ranking | Regular source code |
| Bonus | Higher rank | Core business logic |
node_modules, .git)tests, docs)After configuring boosting:
# Search and observe rankings
grepai search "authentication"
# Check if tests are properly deprioritized
grepai search "test authentication" # Should still find tests, but ranked lower
β Problem: Tests always show up first β Solution: Add penalty patterns for your test naming convention
β Problem: Can't find code in penalized paths β Solution: Penalties reduce rank, don't hide. Use ignore for complete exclusion.
β Problem: Scores above 1.0 seem wrong β Solution: Bonuses can push scores above 1.0; this is normal
β Problem: Pattern not matching
β
Solution: Check that pattern appears in full path (use /tests/ not just tests)
Boosting configuration status:
β
Search Boosting Configured
Status: Enabled
Penalties (5):
- /tests/ β 0.5 (50% reduction)
- _test. β 0.5
- .spec. β 0.5
- /vendor/ β 0.3 (70% reduction)
- /docs/ β 0.6
Bonuses (3):
- /src/ β 1.1 (10% boost)
- /lib/ β 1.1
- /core/ β 1.2 (20% boost)
Effect: Source code ranks higher than tests with similar content