Explorar el Código

query::KeyValueQuery: Use raw tags for dense nodes

Johannes Hofmann hace 7 años
padre
commit
3dbfa7769d
Se han modificado 1 ficheros con 7 adiciones y 4 borrados
  1. 7
    4
      src/query.rs

+ 7
- 4
src/query.rs Ver fichero

@@ -154,10 +154,13 @@ impl Query for KeyValueQuery {
154 154
         return false;
155 155
     }
156 156
 
157
-    fn dense_node_matches(&self, _bi: &Self::BI, dnode: &DenseNode) -> bool {
158
-        //TODO use raw tags
159
-        for (key, val) in dnode.tags() {
160
-            if key == self.key && val == self.value {
157
+    fn dense_node_matches(&self, bi: &Self::BI, dnode: &DenseNode) -> bool {
158
+        for (key, val) in dnode.raw_tags() {
159
+            if key >= 0 &&
160
+               val >= 0 &&
161
+               bi.0.binary_search(&(key as u32)).is_ok() &&
162
+               bi.1.binary_search(&(val as u32)).is_ok()
163
+            {
161 164
                 return true;
162 165
             }
163 166
         }