1
0
Fork 0

Store documents in a skiplist index even if some indexed attrs are empty.

This commit is contained in:
Max Neunhoeffer 2014-08-29 23:54:22 +02:00
parent 1367a016cf
commit dc0c204424
1 changed files with 12 additions and 1 deletions

View File

@ -1275,7 +1275,14 @@ static int SkiplistIndexHelper (const TRI_skiplist_index_t* skiplistIndex,
TRI_shape_access_t const* acc = TRI_FindAccessorVocShaper(skiplistIndex->base._collection->getShaper(), shapedJson._sid, shape); // ONLY IN INDEX, PROTECTED by RUNTIME TRI_shape_access_t const* acc = TRI_FindAccessorVocShaper(skiplistIndex->base._collection->getShaper(), shapedJson._sid, shape); // ONLY IN INDEX, PROTECTED by RUNTIME
if (acc == nullptr || acc->_resultSid == TRI_SHAPE_ILLEGAL) { if (acc == nullptr || acc->_resultSid == TRI_SHAPE_ILLEGAL) {
return TRI_ERROR_ARANGO_INDEX_DOCUMENT_ATTRIBUTE_MISSING; // OK, the document does not contain the attributed needed by
// the index, so let's fake a JSON null:
skiplistElement->_subObjects[j]._sid = TRI_SHAPE_NULL;
skiplistElement->_subObjects[j]._length = 0;
skiplistElement->_subObjects[j]._offset = 0;
continue;
// This used to be:
// return TRI_ERROR_ARANGO_INDEX_DOCUMENT_ATTRIBUTE_MISSING;
} }
@ -1339,6 +1346,10 @@ static int InsertSkiplistIndex (TRI_index_t* idx,
// most likely the cause of this error is that the 'shape' of the document // most likely the cause of this error is that the 'shape' of the document
// does not match the 'shape' of the index structure -- so the document // does not match the 'shape' of the index structure -- so the document
// is ignored. So not really an error at all. // is ignored. So not really an error at all.
// Changed: empty attributes are currently always treated as if they
// were bound to null, so TRI_ERROR_ARANGO_INDEX_DOCUMENT_ATTRIBUTE_MISSING
// cannot happen at all. When we have a sparse skiplist index, this
// can reappear, therefore we leave the case distinction below in.
// ........................................................................... // ...........................................................................
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {