~jelmer/bzr-search/merge

« back to all changes in this revision

Viewing changes to index.py

  • Committer: Robert Collins
  • Date: 2008-12-02 22:36:33 UTC
  • Revision ID: robertc@robertcollins.net-20081202223633-et3bqd5i8d3qnu94
Make BTree indices be used by default.

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
        _tokeniser_re = re.compile("[^A-Za-z0-9_]")
86
86
 
87
87
 
88
 
def init_index(branch, format_number=1):
 
88
def init_index(branch, format_number=2):
89
89
    """Initialise an index on branch.
90
90
    
91
91
    :param format_number: The index format to create. Currently 1 by default.
1388
1388
            node_indices = set([low_index, high_index])
1389
1389
            nodes = self._get_internal_nodes(node_indices)
1390
1390
            low_node = nodes[low_index]
1391
 
            positions = self._multi_bisect_right([lower_key], node.keys)
1392
 
            node_offset = next_row_start + node.offset
1393
 
            low_index = node_offset + positions[0]
 
1391
            positions = self._multi_bisect_right([lower_key], low_node.keys)
 
1392
            node_offset = next_row_start + low_node.offset
 
1393
            low_index = node_offset + positions[0][0]
1394
1394
            high_node = nodes[high_index]
1395
 
            positions = self._multi_bisect_right([higher_key], node.keys)
1396
 
            node_offset = next_row_start + node.offset
1397
 
            high_index = node_offset + positions[0]
 
1395
            positions = self._multi_bisect_right([higher_key], high_node.keys)
 
1396
            node_offset = next_row_start + high_node.offset
 
1397
            high_index = node_offset + positions[0][0]
1398
1398
        # We should now be at the _LeafNodes
1399
1399
        node_indices = range(low_index, high_index + 1)
1400
1400
 
1521
1521
_FORMATS = {
1522
1522
    # format: index builder, index reader, index deletes
1523
1523
    _FORMAT_1:(InMemoryGraphIndex, SuggestableGraphIndex, False),
1524
 
    _FORMAT_2:(BTreeBuilder, BTreeGraphIndex, True)
 
1524
    _FORMAT_2:(BTreeBuilder, SuggestableBTreeGraphIndex, True)
1525
1525
    }