mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-04-16 12:12:25 +00:00
Some checks are pending
/ release (push) Waiting to run
testing / backend-checks (push) Has been skipped
testing / test-mysql (push) Has been skipped
testing / test-pgsql (push) Has been skipped
testing / test-sqlite (push) Has been skipped
testing / test-remote-cacher (redis) (push) Has been skipped
testing / test-remote-cacher (valkey) (push) Has been skipped
testing / test-remote-cacher (garnet) (push) Has been skipped
testing / test-remote-cacher (redict) (push) Has been skipped
testing / frontend-checks (push) Has been skipped
testing / test-unit (push) Has been skipped
testing / test-e2e (push) Has been skipped
testing / security-check (push) Has been skipped
This PR contains the following updates:
| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/blevesearch/bleve/v2](https://github.com/blevesearch/bleve) | require | minor | `v2.4.4` -> `v2.5.0` |
---
### Release Notes
<details>
<summary>blevesearch/bleve (github.com/blevesearch/bleve/v2)</summary>
### [`v2.5.0`](https://github.com/blevesearch/bleve/releases/tag/v2.5.0)
[Compare Source](https://github.com/blevesearch/bleve/compare/v2.4.4...v2.5.0)
##### Bug Fixes
- Exact hits to score higher than fuzzy hits, with https://github.com/blevesearch/bleve/pull/2056
- Fix boosting during hybrid search that involves text + nearest neighbor, with https://github.com/blevesearch/bleve/pull/2127
- Addressed bug in IP field handling while highlighting, with https://github.com/blevesearch/bleve/pull/2142
- Graceful error handling within registry, with https://github.com/blevesearch/bleve/pull/2151
- `http/` package (meant for demo purposes) removed from repository to remove vulnerability - [CVE-2022-31022](https://github.com/blevesearch/bleve/security/advisories/GHSA-9w9f-6mg8-jp7w), relocated to within https://github.com/blevesearch/bleve-explorer
- Geo radius queries will now advertise distances (within sort values) in readable format, with https://github.com/blevesearch/bleve/pull/2137
##### Improvements
- Vector search requires `faiss` dynamic library to be built from [blevesearch/faiss@352484e](352484e0fc
) which is a modified version of [v1.10.0](https://github.com/facebookresearch/faiss/releases/tag/v1.10.0)
- Support for **BM25 scoring**, see: [scoring.md](https://github.com/blevesearch/bleve/blob/v2.5.0/docs/scoring.md#bm25)
- Support for **synonyms' search**, see: [synonyms.md](https://github.com/blevesearch/bleve/blob/v2.5.0/docs/synonyms.md)
- **Significant performance improvements in pre-filtered vector search**, with https://github.com/blevesearch/bleve/pull/2169 + dependent changes
- `auto` fuzziness detection with https://github.com/blevesearch/bleve/pull/2060
- Ability to affect ingestion/drain rate by tuning persister workers with https://github.com/blevesearch/bleve/pull/2100
- Additional config in merge policy for improved merger behavior, with https://github.com/blevesearch/bleve/pull/2134
- Geo improvements: footprint reduction for polygons, better validation and graceful error handling, with https://github.com/blevesearch/bleve/pull/2162 + https://github.com/blevesearch/bleve/pull/2158 + https://github.com/blevesearch/bleve/pull/2165
- Upgrade to RoaringBitmap/roaring@v2.4.5, etcd.io/bbolt@v1.4.0
- More metrics
##### Milestone
- [v2.5.0](https://github.com/blevesearch/bleve/milestone/24)
</details>
---
### Configuration
📅 **Schedule**: Branch creation - "* 0-3 * * *" (UTC), Automerge - "* 0-3 * * *" (UTC).
🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.
♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box
---
This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMjIuMSIsInVwZGF0ZWRJblZlciI6IjM5LjIyMi4xIiwidGFyZ2V0QnJhbmNoIjoiZm9yZ2VqbyIsImxhYmVscyI6WyJkZXBlbmRlbmN5LXVwZ3JhZGUiLCJ0ZXN0L25vdC1uZWVkZWQiXX0=-->
Co-authored-by: Gusted <postmaster@gusted.xyz>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7468
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Shiny Nematoda <snematoda@noreply.codeberg.org>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
65 lines
1.9 KiB
Go
65 lines
1.9 KiB
Go
// Copyright 2023 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package bleve
|
|
|
|
import (
|
|
"forgejo.org/modules/optional"
|
|
|
|
"github.com/blevesearch/bleve/v2"
|
|
"github.com/blevesearch/bleve/v2/search/query"
|
|
)
|
|
|
|
// NumericEqualityQuery generates a numeric equality query for the given value and field
|
|
func NumericEqualityQuery(value int64, field string) *query.NumericRangeQuery {
|
|
f := float64(value)
|
|
tru := true // codespell:ignore
|
|
q := bleve.NewNumericRangeInclusiveQuery(&f, &f, &tru, &tru) // codespell:ignore
|
|
q.SetField(field)
|
|
return q
|
|
}
|
|
|
|
// MatchQuery generates a match query for the given phrase, field and analyzer
|
|
func MatchQuery(matchTerm, field, analyzer string, fuzziness int) *query.MatchQuery {
|
|
q := bleve.NewMatchQuery(matchTerm)
|
|
q.FieldVal = field
|
|
q.Analyzer = analyzer
|
|
q.Fuzziness = fuzziness
|
|
return q
|
|
}
|
|
|
|
// MatchPhraseQuery generates a match phrase query for the given phrase, field and analyzer
|
|
func MatchPhraseQuery(matchPhrase, field, analyzer string, autoFuzzy bool) *query.MatchPhraseQuery {
|
|
q := bleve.NewMatchPhraseQuery(matchPhrase)
|
|
q.FieldVal = field
|
|
q.Analyzer = analyzer
|
|
q.SetAutoFuzziness(autoFuzzy)
|
|
return q
|
|
}
|
|
|
|
// BoolFieldQuery generates a bool field query for the given value and field
|
|
func BoolFieldQuery(value bool, field string) *query.BoolFieldQuery {
|
|
q := bleve.NewBoolFieldQuery(value)
|
|
q.SetField(field)
|
|
return q
|
|
}
|
|
|
|
func NumericRangeInclusiveQuery(min, max optional.Option[int64], field string) *query.NumericRangeQuery {
|
|
var minF, maxF *float64
|
|
var minI, maxI *bool
|
|
if min.Has() {
|
|
minF = new(float64)
|
|
*minF = float64(min.Value())
|
|
minI = new(bool)
|
|
*minI = true
|
|
}
|
|
if max.Has() {
|
|
maxF = new(float64)
|
|
*maxF = float64(max.Value())
|
|
maxI = new(bool)
|
|
*maxI = true
|
|
}
|
|
q := bleve.NewNumericRangeInclusiveQuery(minF, maxF, minI, maxI)
|
|
q.SetField(field)
|
|
return q
|
|
}
|