8000 [3.8] Fix for ES-1147 (#16298) · arangodb/arangodb@cb1d4ac · GitHub
[go: up one dir, main page]

Skip to content

Commit cb1d4ac

Browse files
authored
[3.8] Fix for ES-1147 (#16298)
* fix boost propagation * Update CHANGELOG * wip
1 parent ca246b0 commit cb1d4ac

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
v3.8.7 (XXXX-XX-XX)
22
-------------------
33

4+
* Fix ES-1147. Fixed boost propagation in STARTS_WITH function.
5+
46
* Fix documentation of collection's `cacheEnabled` property default.
57

68
* Make all requests which are needed for shard resync at least medium priority

arangod/IResearch/IResearchFilterFactory.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3581,17 +3581,21 @@ Result fromFuncStartsWith(
35813581

35823582
TRI_ASSERT(filterCtx.analyzer);
35833583
kludge::mangleField(name, filterCtx.analyzer);
3584-
filter->boost(filterCtx.boost);
35853584

35863585
if (isMultiPrefix) {
35873586
auto& minMatchFilter = filter->add<irs::Or>();
35883587
minMatchFilter.min_match_count(static_cast<size_t>(minMatchCount));
3588+
minMatchFilter.boost(filterCtx.boost);
35893589
// become a new root
35903590
filter = &minMatchFilter;
35913591
}
35923592

35933593
for (size_t i = 0, size = prefixes.size(); i < size; ++i) {
35943594
auto& prefixFilter = filter->add<irs::by_prefix>();
3595+
if (!isMultiPrefix) {
3596+
TRI_ASSERT(prefixes.size() == 1);
3597+
prefixFilter.boost(filterCtx.boost);
3598+
}
35953599
if (i + 1 < size) {
35963600
*prefixFilter.mutable_field() = name;
35973601
} else {

tests/IResearch/IResearchFilterFunction-test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5481,8 +5481,8 @@ TEST_F(IResearchFilterFunctionTest, StartsWith) {
54815481
// with scoring limit (double), boost
54825482
{
54835483
irs::Or expected;
5484-
expected.boost(3.1f);
54855484
auto& prefix = expected.add<irs::by_prefix>();
5485+
prefix.boost(3.1f);
54865486
*prefix.mutable_field() = mangleStringIdentity("name");
54875487
auto* opt = prefix.mutable_options();
54885488
opt->term = irs::ref_cast<irs::byte_type>(irs::string_ref("abc"));
@@ -5503,10 +5503,10 @@ TEST_F(IResearchFilterFunctionTest, StartsWith) {
55035503
// with scoring limit with min match count (double), boost
55045504
{
55055505
irs::Or expected;
5506-
expected.boost(3.1f);
55075506
auto& orFilter = expected.add<irs::Or>();
55085507
orFilter.min_match_count(2);
55095508
auto& prefix = orFilter.add<irs::by_prefix>();
5509+
orFilter.boost(3.1f);
55105510
*prefix.mutable_field() = mangleStringIdentity("name");
55115511
auto* opt = prefix.mutable_options();
55125512
opt->term = irs::ref_cast<irs::byte_type>(irs::string_ref("abc"));

0 commit comments

Comments
 (0)
0