chiark / gitweb /
documentation: reduce magic constants in search implementation a bit.
authorVladimír Vondruš <mosra@centrum.cz>
Tue, 12 May 2020 06:43:01 +0000 (08:43 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Tue, 12 May 2020 06:43:01 +0000 (08:43 +0200)
documentation/_search.py

index cd8b64389f34a7ba865ebaa9250f17338cbd6825..482fd3d5ca2f915ebf6ffb1d86e4700fbe7dfbb9 100644 (file)
@@ -232,15 +232,15 @@ class ResultMap:
 
             # The entry is an alias, extra field for alias index
             if e.flags & ResultFlag._TYPE == ResultFlag.ALIAS:
-                offset += 2
+                offset += self.alias_struct.size
 
             # Extra field for prefix index and length
             if e.flags & ResultFlag.HAS_PREFIX:
-                offset += 3
+                offset += self.prefix_struct.size
 
             # Extra field for suffix length
             if e.flags & ResultFlag.HAS_SUFFIX:
-                offset += 1
+                offset += self.suffix_length_struct.size
 
             # Length of the name
             offset += len(e.name.encode('utf-8'))