1
0
Fork 0

Merge branch 'spdvpk' of https://github.com/arangodb/arangodb into spdvpk

This commit is contained in:
Jan Steemann 2016-03-24 12:46:23 +01:00
commit b8e5064c45
2 changed files with 8 additions and 6 deletions

View File

@ -248,11 +248,11 @@ void PathBasedIndex::buildIndexValues(
if (_expanding[level] == -1) { // the trivial, non-expanding case if (_expanding[level] == -1) { // the trivial, non-expanding case
VPackSlice slice = document.get(_paths[level]); VPackSlice slice = document.get(_paths[level]);
if (slice.isNone()) { if (slice.isNone() || slice.isNull()) {
if (_sparse) { if (_sparse) {
return; return;
} }
slice.set(reinterpret_cast<uint8_t const*>("\0x18")); // null slice = arangodb::basics::VelocyPackHelper::NullValue();
} }
sliceStack.push_back(slice); sliceStack.push_back(slice);
buildIndexValues(document, level+1, toInsert, sliceStack); buildIndexValues(document, level+1, toInsert, sliceStack);
@ -267,7 +267,7 @@ void PathBasedIndex::buildIndexValues(
// with None values to be able to use the index for a prefix match. // with None values to be able to use the index for a prefix match.
auto finishWithNones = [&]() -> void { auto finishWithNones = [&]() -> void {
if (level > 0 && !_allowPartialIndex) { if (!_allowPartialIndex || level == 0) {
return; return;
} }
// Trivial case to bottom out with None types. // Trivial case to bottom out with None types.
@ -308,17 +308,17 @@ void PathBasedIndex::buildIndexValues(
auto moveOn = [&](VPackSlice something) -> void { auto moveOn = [&](VPackSlice something) -> void {
auto it = seen.find(something); auto it = seen.find(something);
if (it != seen.end()) { if (it == seen.end()) {
seen.insert(something); seen.insert(something);
sliceStack.push_back(something); sliceStack.push_back(something);
buildIndexValues(document, level+1, toInsert, sliceStack); buildIndexValues(document, level + 1, toInsert, sliceStack);
sliceStack.pop_back(); sliceStack.pop_back();
} }
}; };
for (auto const& member : VPackArrayIterator(current)) { for (auto const& member : VPackArrayIterator(current)) {
VPackSlice current2(member); VPackSlice current2(member);
bool doneNull = false; bool doneNull = false;
for (size_t i = _expanding[level]+1; i < n; i++) { for (size_t i = _expanding[level] + 1; i < n; i++) {
if (!current2.isObject()) { if (!current2.isObject()) {
if (!_sparse) { if (!_sparse) {
moveOn(arangodb::basics::VelocyPackHelper::NullValue()); moveOn(arangodb::basics::VelocyPackHelper::NullValue());

View File

@ -221,6 +221,8 @@ static int TypeWeight(VPackSlice const& slice) {
return 4; return 4;
case VPackValueType::Object: case VPackValueType::Object:
return 5; return 5;
case VPackValueType::None:
return 6;
default: default:
// All other values have equal weight // All other values have equal weight
return 0; return 0;