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

Skip to content

treat all iresearch scores as float_t for 3.4 (#7573) #7578

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions arangod/Aql/ClusterBlocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ bool OurLessThan::operator()(
int cmp;

if (attributePath.empty()) {
#ifdef USE_IRESEARCH
#if 0 // #ifdef USE_IRESEARCH
TRI_ASSERT(reg.comparator);
cmp = (*reg.comparator)(reg.scorer.get(), _trx, lhs, rhs);
#else
cmp = AqlValue::Compare(_trx, lhs, rhs, true);
cmp = AqlValue::Compare(_trx, lhs, rhs, true);
#endif
} else {
// Take attributePath into consideration:
Expand Down
4 changes: 2 additions & 2 deletions arangod/Aql/SortBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ class OurLessThan {
auto const& lhs = _buffer[a.first]->getValueReference(a.second, reg.reg);
auto const& rhs = _buffer[b.first]->getValueReference(b.second, reg.reg);

#ifdef USE_IRESEARCH
#if 0 // #ifdef USE_IRESEARCH
TRI_ASSERT(reg.comparator);
int const cmp = (*reg.comparator)(reg.scorer.get(), _trx, lhs, rhs);
#else
int const cmp = AqlValue::Compare(_trx, lhs, rhs, true);
int const cmp = AqlValue::Compare(_trx, lhs, rhs, true);
#endif

if (cmp < 0) {
Expand Down
4 changes: 2 additions & 2 deletions arangod/Aql/SortRegister.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "Aql/ExecutionPlan.h"
#include "Aql/SortNode.h"

#ifdef USE_IRESEARCH
#if 0 // #ifdef USE_IRESEARCH
#include "IResearch/IResearchViewNode.h"
#include "IResearch/IResearchOrderFactory.h"

Expand Down Expand Up @@ -82,7 +82,7 @@ SortRegister::SortRegister(
asc(element.ascending) {
}

#ifdef USE_IRESEARCH
#if 0 // #ifdef USE_IRESEARCH

void SortRegister::fill(
ExecutionPlan const& execPlan,
Expand Down
6 changes: 3 additions & 3 deletions arangod/Aql/SortRegister.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "Aql/ExecutionNode.h"
#include "types.h"

#ifdef USE_IRESEARCH
#if 0 // #ifdef USE_IRESEARCH
#include "search/sort.hpp"
#endif

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

#ifdef USE_IRESEARCH
#if 0 // #ifdef USE_IRESEARCH
SortRegister(
RegisterId reg,
SortElement const& element,
Expand Down
7 changes: 5 additions & 2 deletions arangod/IResearch/IResearchFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ size_t computeThreadPoolSize(size_t threads, size_t threadsLimit) {
;
}

void registerFunctions(arangodb::aql::AqlFunctionFeature& functions) {
void registerFunctions(arangodb::aql::AqlFunctionFeature& /*functions*/) {
#if 0
arangodb::iresearch::addFunction(functions, {
"__ARANGOSEARCH_SCORE_DEBUG", // name
".", // value to convert
Expand All @@ -172,11 +173,13 @@ void registerFunctions(arangodb::aql::AqlFunctionFeature& functions) {
return arangodb::aql::AqlValue(arangodb::aql::AqlValueHintDouble(double_t(std::nan(""))));
} else {
// unsafe
auto const floatValue = *reinterpret_cast<float_t const*>(args[0].slice().begin());
VPackValueLength length;
auto const floatValue = *reinterpret_cast<float_t const*>(args[0].slice().getString(length));
return arangodb::aql::AqlValue(arangodb::aql::AqlValueHintDouble(double_t(floatValue)));
}
}
});
#endif
}

void registerFilters(arangodb::aql::AqlFunctionFeature& functions) {
Expand Down
7 changes: 7 additions & 0 deletions arangod/IResearch/IResearchViewBlock.cpp
8AB7
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,17 @@ bool IResearchViewBlock::next(
auto scoreRegs = ctx.curRegs;

for (size_t i = 0; i < numSorts; ++i) {
// in 3.4 we assume all scorers return float_t
auto const score = _order.get<float_t>(_scrVal.c_str(), i);

ctx.res->setValue(
ctx.pos,
++scoreRegs,
#if 0
_order.to_string<AqlValue, std::char_traits<char>>(_scrVal.c_str(), i)
#else
AqlValue(AqlValueHintDouble(double_t(score)))
#endif
);
}

Expand Down
0