8000 treat all iresearch scores as float_t for 3.4 (#7573) (#7578) · surajpatel11/arangodb@d6de637 · GitHub
[go: up one dir, main page]

Skip to content

Commit d6de637

Browse files
author
Andrey Abramov
authored
treat all iresearch scores as float_t for 3.4 (arangodb#7573) (arangodb#7578)
* treat all iresearch scores as float_t for 3.4 * cleanup * attempt to fix tests * another attempt to fix tests
1 parent 710ca04 commit d6de637

File tree

6 files changed

+21
-11
lines changed

6 files changed

+21
-11
lines changed

arangod/Aql/ClusterBlocks.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ bool OurLessThan::operator()(
113113
int cmp;
114114

115115
if (attributePath.empty()) {
116-
#ifdef USE_IRESEARCH
116+
#if 0 // #ifdef USE_IRESEARCH
117117
TRI_ASSERT(reg.comparator);
118118
cmp = (*reg.comparator)(reg.scorer.get(), _trx, lhs, rhs);
119119
#else
120-
cmp = AqlValue::Compare(_trx, lhs, rhs, true);
120+
cmp = AqlValue::Compare(_trx, lhs, rhs, true);
121121
#endif
122122
} else {
123123
// Take attributePath into consideration:

arangod/Aql/SortBlock.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ class OurLessThan {
4949
auto const& lhs = _buffer[a.first]->getValueReference(a.second, reg.reg);
5050
auto const& rhs = _buffer[b.first]->getValueReference(b.second, reg.reg);
5151

52-
#ifdef USE_IRESEARCH
52+
#if 0 // #ifdef USE_IRESEARCH
5353
TRI_ASSERT(reg.comparator);
5454
int const cmp = (*reg.comparator)(reg.scorer.get(), _trx, lhs, rhs);
5555
#else
56-
int const cmp = AqlValue::Compare(_trx, lhs, rhs, true);
56+
int const cmp = AqlValue::Compare(_trx, lhs, rhs, true);
5757
#endif
5858

5959
if (cmp < 0) {

arangod/Aql/SortRegister.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "Aql/ExecutionPlan.h"
2929
#include "Aql/SortNode.h"
3030

31-
#ifdef USE_IRESEARCH
31+
#if 0 // #ifdef USE_IRESEARCH
3232
#include "IResearch/IResearchViewNode.h"
3333
#include "IResearch/IResearchOrderFactory.h"
3434

@@ -82,7 +82,7 @@ SortRegister::SortRegister(
8282
asc(element.ascending) {
8383
}
8484

85-
#ifdef USE_IRESEARCH
85+
#if 0 // #ifdef USE_IRESEARCH
8686

8787
void SortRegister::fill(
8888
ExecutionPlan const& execPlan,

arangod/Aql/SortRegister.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "Aql/ExecutionNode.h"
2828
#include "types.h"
2929

30-
#ifdef USE_IRESEARCH
30+
#if 0 // #ifdef USE_IRESEARCH
3131
#include "search/sort.hpp"
3232
#endif
3333

@@ -37,7 +37,7 @@ namespace aql {
3737
/// @brief sort element for block, consisting of register, sort direction,
3838
/// and a possible attribute path to dig into the document
3939
struct SortRegister {
40-
#ifdef USE_IRESEARCH
40+
#if 0 // #ifdef USE_IRESEARCH
4141
typedef int(*CompareFunc)(
4242
irs::sort::prepared const* scorer,
4343
transaction::Methods* trx,
@@ -57,7 +57,7 @@ struct SortRegister {
5757
SortElement const& element
5858
) noexcept;
5959

60-
#ifdef USE_IRESEARCH
60+
#if 0 // #ifdef USE_IRESEARCH
6161
SortRegister(
6262
RegisterId reg,
6363
SortElement const& element,

arangod/IResearch/IResearchFeature.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ size_t computeThreadPoolSize(size_t threads, size_t threadsLimit) {
155155
;
156156
}
157157

158-
void registerFunctions(arangodb::aql::AqlFunctionFeature& functions) {
158+
void registerFunctions(arangodb::aql::AqlFunctionFeature& /*functions*/) {
159+
#if 0
159160
arangodb::iresearch::addFunction(functions, {
160161
"__ARANGOSEARCH_SCORE_DEBUG", // name
161162
".", // value to convert
@@ -172,11 +173,13 @@ void registerFunctions(arangodb::aql::AqlFunctionFeature& functions) {
172173
return arangodb::aql::AqlValue(arangodb::aql::AqlValueHintDouble(double_t(std::nan(""))));
173174
} else {
174175
// unsafe
175-
auto const floatValue = *reinterpret_cast<float_t const*>(args[0].slice().begin());
176+
VPackValueLength length;
177+
auto const floatValue = *reinterpret_cast<float_t const*>(args[0].slice().getString(length));
176178
return arangodb::aql::AqlValue(arangodb::aql::AqlValueHintDouble(double_t(floatValue)));
177179
}
178180
}
179181
});
182+
#endif
180183
}
181184

182185
void registerFilters(arangodb::aql::AqlFunctionFeature& functions) {

arangod/IResearch/IResearchViewBlock.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,10 +492,17 @@ bool IResearchViewBlock::next(
492492
auto scoreRegs = ctx.curRegs;
493493

494494
for (size_t i = 0; i < numSorts; ++i) {
495+
// in 3.4 we assume all scorers return float_t
496+
auto const score = _order.get<float_t>(_scrVal.c_str(), i);
497+
495498
ctx.res->setValue(
496499
ctx.pos,
497500
++scoreRegs,
501+
#if 0
498502
_order.to_string<AqlValue, std::char_traits<char>>(_scrVal.c_str(), i)
503+
#else
504+
AqlValue(AqlValueHintDouble(double_t(score)))
505+
#endif
499506
);
500507
}
501508

0 commit comments

Comments
 (0)
0