Fix uninit variable (hits_limit)
[idzebra-moved-to-github.git] / index / kcontrol.c
index 4594a90..58309a0 100644 (file)
@@ -1,8 +1,5 @@
-/* $Id: kcontrol.c,v 1.4 2006-08-14 10:40:15 adam Exp $
-   Copyright (C) 1995-2006
-   Index Data ApS
-
-This file is part of the Zebra server.
+/* This file is part of the Zebra server.
+   Copyright (C) 1994-2011 Index Data
 
 Zebra is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
@@ -20,6 +17,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 */
 
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 #include <assert.h>
 #include "index.h"
 
@@ -56,22 +56,26 @@ static void my_dec(struct rset_key_control *kc)
 
 struct rset_key_control *zebra_key_control_create(ZebraHandle zh)
 {
-    const char *res_val;
     struct rset_key_control *kc = xmalloc(sizeof(*kc));
     struct context_control *cp = xmalloc(sizeof(*cp));
 
     kc->context = cp;
     kc->key_size = sizeof(struct it_key);
-    kc->scope = 2;
     kc->cmp = key_compare_it;
     kc->key_logdump_txt = key_logdump_txt;
     kc->getseq = key_get_seq;
-    res_val = zebra_get_resource(zh, "segment", 0);
-    kc->get_segment = 0;
-    if (res_val && atoi(res_val))
+
+    if (zh->m_segment_indexing)
     {
+        kc->scope = 3;  /* segment + seq is "same" record */
         kc->get_segment = key_get_segment;
     }
+    else
+    {
+        kc->scope = 2;  /* seq is "same" record */
+        kc->get_segment = 0;
+    }
+
     zebra_limit_for_rset(zh->m_limit, 
                         &kc->filter_func,
                         &cp->filter_destroy,
@@ -85,6 +89,7 @@ struct rset_key_control *zebra_key_control_create(ZebraHandle zh)
 /*
  * Local variables:
  * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
  * indent-tabs-mode: nil
  * End:
  * vim: shiftwidth=4 tabstop=8 expandtab