projects
/
idzebra-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Honor position attribute, i.e. allow first-in-field search. To
[idzebra-moved-to-github.git]
/
index
/
kcompare.c
diff --git
a/index/kcompare.c
b/index/kcompare.c
index
af02709
..
00050c7
100644
(file)
--- a/
index/kcompare.c
+++ b/
index/kcompare.c
@@
-1,6
+1,6
@@
-/* $Id: kcompare.c,v 1.52 2004-09-15 08:13:51 adam Exp $
- Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
- Index Data Aps
+/* $Id: kcompare.c,v 1.61 2006-08-16 13:16:36 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.
@@
-15,9
+15,9
@@
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
-along with Zebra; see the file LICENSE.zebra. If not, write to the
-Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
*/
#include <stdlib.h>
*/
#include <stdlib.h>
@@
-33,9
+33,11
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#define CODEC_INLINE
#endif
#define CODEC_INLINE
#endif
-void key_logdump_txt (int logmask, const void *p, const char *txt)
+void key_logdump_txt(int logmask, const void *p, const char *txt)
{
struct it_key key;
{
struct it_key key;
+ if (!txt)
+ txt = "(none)";
if (p)
{
char formstr[128];
if (p)
{
char formstr[128];
@@
-46,17
+48,17
@@
void key_logdump_txt (int logmask, const void *p, const char *txt)
*formstr = '\0';
for (i = 0; i<key.len; i++)
{
*formstr = '\0';
for (i = 0; i<key.len; i++)
{
- sprintf(formstr + strlen(formstr), ZINT_FORMAT, key.mem[i]);
if (i)
if (i)
- strcat(formstr, " ");
+ strcat(formstr, ".");
+ sprintf(formstr + strlen(formstr), ZINT_FORMAT, key.mem[i]);
}
}
- logf (logmask, "%s %s", formstr, txt);
+ yaz_log(logmask, "%s %s", formstr, txt);
}
else
}
else
- logf(logmask, " (null) %s",txt);
+ yaz_log(logmask, " (no key) %s",txt);
}
}
-void key_logdump (int logmask, const void *p)
+void key_logdump(int logmask, const void *p)
{
key_logdump_txt(logmask, p, "");
}
{
key_logdump_txt(logmask, p, "");
}
@@
-66,7
+68,7
@@
int key_compare_it (const void *p1, const void *p2)
int i, l = ((struct it_key *) p1)->len;
if (((struct it_key *) p2)->len > l)
l = ((struct it_key *) p2)->len;
int i, l = ((struct it_key *) p1)->len;
if (((struct it_key *) p2)->len > l)
l = ((struct it_key *) p2)->len;
- assert (l <= 4 && l > 0);
+ assert (l <= IT_KEY_LEVEL_MAX && l > 0);
for (i = 0; i < l; i++)
{
if (((struct it_key *) p1)->mem[i] != ((struct it_key *) p2)->mem[i])
for (i = 0; i < l; i++)
{
if (((struct it_key *) p1)->mem[i] != ((struct it_key *) p2)->mem[i])
@@
-95,7
+97,7
@@
int key_compare (const void *p1, const void *p2)
l = i1.len;
if (i2.len > l)
l = i2.len;
l = i1.len;
if (i2.len > l)
l = i2.len;
- assert (l <= 4 && l > 0);
+ assert (l <= IT_KEY_LEVEL_MAX && l > 0);
for (i = 0; i < l; i++)
{
if (i1.mem[i] != i2.mem[i])
for (i = 0; i < l; i++)
{
if (i1.mem[i] != i2.mem[i])
@@
-116,6
+118,13
@@
zint key_get_seq(const void *p)
return k.mem[k.len-1];
}
return k.mem[k.len-1];
}
+zint key_get_segment(const void *p)
+{
+ struct it_key k;
+ memcpy (&k, p, sizeof(k));
+ return k.mem[k.len-2];
+}
+
int key_qsort_compare (const void *p1, const void *p2)
{
int r;
int key_qsort_compare (const void *p1, const void *p2)
{
int r;
@@
-147,7
+156,7
@@
void key_init(struct it_key *key)
{
int i;
key->len = 0;
{
int i;
key->len = 0;
- for (i = 0; i<IT_KEY_LEVEL_MAX; i++)
+ for (i = 0; i < IT_KEY_LEVEL_MAX; i++)
key->mem[i] = 0;
}
key->mem[i] = 0;
}
@@
-156,7
+165,7
@@
void iscz1_reset (void *vp)
struct iscz1_code_info *p = (struct iscz1_code_info *) vp;
int i;
p->key.len = 0;
struct iscz1_code_info *p = (struct iscz1_code_info *) vp;
int i;
p->key.len = 0;
- for (i = 0; i< IT_KEY_LEVEL_MAX; i++)
+ for (i = 0; i < IT_KEY_LEVEL_MAX; i++)
p->key.mem[i] = 0;
}
p->key.mem[i] = 0;
}
@@
-214,7
+223,7
@@
void iscz1_encode (void *vp, char **dst, const char **src)
/* deal with leader + delta encoding .. */
d = 0;
/* deal with leader + delta encoding .. */
d = 0;
- assert(tkey.len > 0 && tkey.len <= 4);
+ assert(tkey.len > 0 && tkey.len <= IT_KEY_LEVEL_MAX);
for (i = 0; i < tkey.len; i++)
{
d = tkey.mem[i] - p->key.mem[i];
for (i = 0; i < tkey.len; i++)
{
d = tkey.mem[i] - p->key.mem[i];
@@
-281,7
+290,7
@@
ISAMS_M *key_isams_m (Res res, ISAMS_M *me)
ISAMC_M *key_isamc_m (Res res, ISAMC_M *me)
{
ISAMC_M *key_isamc_m (Res res, ISAMC_M *me)
{
- isc_getmethod (me);
+ isamc_getmethod (me);
me->compare_item = key_compare;
me->log_item = key_logdump_txt;
me->compare_item = key_compare;
me->log_item = key_logdump_txt;
@@
-336,3
+345,11
@@
int key_SU_decode (int *ch, const unsigned char *out)
return len;
}
return len;
}
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+