[Groonga-mysql-commit] mroonga/mroonga [master] [wrapper] support index_next and index_prev for spatial index.

Back to archive index

null+****@clear***** null+****@clear*****
2011年 10月 3日 (月) 20:33:59 JST


Kouhei Sutou	2011-10-03 11:33:59 +0000 (Mon, 03 Oct 2011)

  New Revision: 05ae300ab9c974606aead717ad16b94a9a436ec0

  Log:
    [wrapper] support index_next and index_prev for spatial index.
    
    But they aren't used in the current tests. They are needed?

  Modified files:
    ha_mroonga.cc

  Modified: ha_mroonga.cc (+26 -16)
===================================================================
--- ha_mroonga.cc    2011-10-03 11:28:50 +0000 (f1b8166)
+++ ha_mroonga.cc    2011-10-03 11:33:59 +0000 (ddf4b6a)
@@ -4467,17 +4467,22 @@ int ha_mroonga::wrapper_index_next(uchar *buf)
 {
   int error = 0;
   MRN_DBUG_ENTER_METHOD();
-  MRN_SET_WRAP_SHARE_KEY(share, table->s);
-  MRN_SET_WRAP_TABLE_KEY(this, table);
-  if (fulltext_searching)
-    set_pk_bitmap();
+  KEY key_info = table->key_info[active_index];
+  if (mrn_is_geo_key(&key_info)) {
+    error = wrapper_get_next_record(buf);
+  } else {
+    MRN_SET_WRAP_SHARE_KEY(share, table->s);
+    MRN_SET_WRAP_TABLE_KEY(this, table);
+    if (fulltext_searching)
+      set_pk_bitmap();
 #ifdef MRN_HANDLER_HAVE_HA_INDEX_NEXT
-  error = wrap_handler->ha_index_next(buf);
+    error = wrap_handler->ha_index_next(buf);
 #else
-  error = wrap_handler->index_next(buf);
+    error = wrap_handler->index_next(buf);
 #endif
-  MRN_SET_BASE_SHARE_KEY(share, table->s);
-  MRN_SET_BASE_TABLE_KEY(this, table);
+    MRN_SET_BASE_SHARE_KEY(share, table->s);
+    MRN_SET_BASE_TABLE_KEY(this, table);
+  }
   DBUG_RETURN(error);
 }
 
@@ -4505,17 +4510,22 @@ int ha_mroonga::wrapper_index_prev(uchar *buf)
 {
   int error = 0;
   MRN_DBUG_ENTER_METHOD();
-  MRN_SET_WRAP_SHARE_KEY(share, table->s);
-  MRN_SET_WRAP_TABLE_KEY(this, table);
-  if (fulltext_searching)
-    set_pk_bitmap();
+  KEY key_info = table->key_info[active_index];
+  if (mrn_is_geo_key(&key_info)) {
+    error = wrapper_get_next_record(buf);
+  } else {
+    MRN_SET_WRAP_SHARE_KEY(share, table->s);
+    MRN_SET_WRAP_TABLE_KEY(this, table);
+    if (fulltext_searching)
+      set_pk_bitmap();
 #ifdef MRN_HANDLER_HAVE_HA_INDEX_NEXT
-  error = wrap_handler->ha_index_prev(buf);
+    error = wrap_handler->ha_index_prev(buf);
 #else
-  error = wrap_handler->index_prev(buf);
+    error = wrap_handler->index_prev(buf);
 #endif
-  MRN_SET_BASE_SHARE_KEY(share, table->s);
-  MRN_SET_BASE_TABLE_KEY(this, table);
+    MRN_SET_BASE_SHARE_KEY(share, table->s);
+    MRN_SET_BASE_TABLE_KEY(this, table);
+  }
   DBUG_RETURN(error);
 }
 




Groonga-mysql-commit メーリングリストの案内
Back to archive index