CodernityDB updates
This commit is contained in:
@@ -952,8 +952,8 @@ you should check index code.""" % (index.name, ex), RuntimeWarning)
|
||||
storage = ind.storage
|
||||
data = storage.get(start, size, status)
|
||||
else:
|
||||
|
||||
data = {}
|
||||
|
||||
if with_doc and index_name != 'id':
|
||||
storage = ind.storage
|
||||
doc = self.get('id', l_key, False)
|
||||
@@ -966,6 +966,7 @@ you should check index code.""" % (index.name, ex), RuntimeWarning)
|
||||
data['_rev'] = _unk
|
||||
else:
|
||||
data['key'] = _unk
|
||||
|
||||
return data
|
||||
|
||||
def get_many(self, index_name, key=None, limit=-1, offset=0, with_doc=False, with_storage=True, start=None, end=None, **kwargs):
|
||||
@@ -1010,6 +1011,8 @@ you should check index code.""" % (index.name, ex), RuntimeWarning)
|
||||
else:
|
||||
data = {}
|
||||
doc_id = ind_data[0]
|
||||
doc_id = doc_id.decode()
|
||||
|
||||
if with_doc:
|
||||
doc = self.get('id', doc_id, False)
|
||||
if data:
|
||||
@@ -1045,13 +1048,15 @@ you should check index code.""" % (index.name, ex), RuntimeWarning)
|
||||
except StopIteration:
|
||||
break
|
||||
else:
|
||||
doc_id = doc_id.decode()
|
||||
|
||||
if index_name == 'id':
|
||||
if with_storage and size:
|
||||
data = storage.get(start, size, status)
|
||||
else:
|
||||
data = {}
|
||||
data['_id'] = doc_id
|
||||
data['_rev'] = unk
|
||||
data['_rev'] = unk.decode()
|
||||
else:
|
||||
data = {}
|
||||
if with_storage and size:
|
||||
|
||||
@@ -632,6 +632,10 @@ class IU_TreeBasedIndex(Index):
|
||||
return buffer_start, (buffer_start + tree_buffer_size)
|
||||
|
||||
def _find_first_key_occurence_in_node(self, node_start, key, nr_of_elements):
|
||||
|
||||
if isinstance(key, str):
|
||||
key = key.encode()
|
||||
|
||||
if nr_of_elements == 1:
|
||||
return self._find_key_in_node_with_one_element(key, node_start, mode=MODE_FIRST)
|
||||
else:
|
||||
@@ -1914,14 +1918,29 @@ class IU_TreeBasedIndex(Index):
|
||||
def get(self, key):
|
||||
## print("------", type(key)) # TODO
|
||||
## print(self) # TODO
|
||||
|
||||
# Fix types
|
||||
if isinstance(key, str):
|
||||
key = key.encode()
|
||||
|
||||
k = self.make_key(key)
|
||||
## print("K:" * 10, k) # TODO
|
||||
return self._find_key(k)
|
||||
|
||||
def get_many(self, key, limit=1, offset=0):
|
||||
# Fix types
|
||||
if isinstance(key, str):
|
||||
key = key.encode()
|
||||
return self._find_key_many(self.make_key(key), limit, offset)
|
||||
|
||||
def get_between(self, start, end, limit=1, offset=0, inclusive_start=True, inclusive_end=True):
|
||||
|
||||
# Fix types
|
||||
if isinstance(start, str):
|
||||
start = start.encode()
|
||||
if isinstance(end, str):
|
||||
end = end.encode()
|
||||
|
||||
if start is None:
|
||||
end = self.make_key(end)
|
||||
if inclusive_end:
|
||||
|
||||
Reference in New Issue
Block a user