-/* $Id: zebraapi.c,v 1.241 2007-01-05 10:45:12 adam Exp $
- Copyright (C) 1995-2006
+/* $Id: zebraapi.c,v 1.250 2007-03-13 13:46:11 adam Exp $
+ Copyright (C) 1995-2007
Index Data ApS
This file is part of the Zebra server.
zh->m_staticrank = 0;
zh->m_segment_indexing = 0;
+ zh->break_handler_func = 0;
+ zh->break_handler_data = 0;
+
default_encoding = res_get_def(zh->session_res, "encoding", "ISO-8859-1");
zh->iconv_to_utf8 =
return ZEBRA_OK;
}
-ZEBRA_RES zebra_search_RPN(ZebraHandle zh, ODR o, Z_RPNQuery *query,
- const char *setname, zint *hits)
+void zebra_set_partial_result(ZebraHandle zh)
+{
+ zh->partial_result = 1;
+}
+
+
+ZEBRA_RES zebra_set_break_handler(ZebraHandle zh,
+ int (*f)(void *client_data),
+ void *client_data)
+{
+ zh->break_handler_func = f;
+ zh->break_handler_data = client_data;
+ return ZEBRA_OK;
+}
+
+ZEBRA_RES zebra_search_RPN_x(ZebraHandle zh, ODR o, Z_RPNQuery *query,
+ const char *setname, zint *hits,
+ int *estimated_hit_count,
+ int *partial_resultset)
{
ZEBRA_RES r;
assert(hits);
assert(setname);
yaz_log(log_level, "zebra_search_rpn");
- zh->hits = 0;
- *hits = 0;
+
+ zh->partial_result = 0;
if (zebra_begin_read(zh) == ZEBRA_FAIL)
return ZEBRA_FAIL;
r = resultSetAddRPN(zh, odr_extract_mem(o), query,
- zh->num_basenames, zh->basenames, setname);
+ zh->num_basenames, zh->basenames, setname,
+ hits, estimated_hit_count);
+
+ *partial_resultset = zh->partial_result;
zebra_end_read(zh);
- *hits = zh->hits;
return r;
}
+ZEBRA_RES zebra_search_RPN(ZebraHandle zh, ODR o, Z_RPNQuery *query,
+ const char *setname, zint *hits)
+{
+ int estimated_hit_count;
+ int partial_resultset;
+ return zebra_search_RPN_x(zh, o, query, setname, hits,
+ &estimated_hit_count,
+ &partial_resultset);
+}
+
ZEBRA_RES zebra_records_retrieve(ZebraHandle zh, ODR stream,
const char *setname,
Z_RecordComposition *comp,
&sysno,
0, /* match */
0, /* fname */
- 0, /* force update */
+ 1, /* force update */
1 /* allow update */
);
if (res == ZEBRA_FAIL)
\param seqno sequence number
val is one of:
- d=writing to shadow(dirty)
- o=no writing,
- c=commit
+ d=writing to shadow(shadow enabled); writing to register (shadow disabled)
+ o=reading only
+ c=commit (writing to register, reading from shadow, shadow mode only)
*/
static void zebra_set_state (ZebraHandle zh, int val, int seqno)
{
v = res_get_prefix(zh->res, "openRW", group, "1");
zh->m_flag_rw = atoi(v);
- v = res_get_prefix(zh->res, "fileVerboseLimit", group, "100000");
+ v = res_get_prefix(zh->res, "fileVerboseLimit", group, "1000");
zh->m_file_verbose_limit = atoi(v);
}
zh->records_updated = 0;
zh->records_deleted = 0;
zh->records_processed = 0;
+ zh->records_skipped = 0;
#if HAVE_SYS_TIMES_H
times (&zh->tms1);
if (val != 'o')
{
/* either we didn't finish commit or shadow is dirty */
+ if (!rval)
+ {
+ yaz_log(YLOG_WARN, "previous transaction did not finish "
+ "(shadow disabled)");
+ }
zebra_unlock (zh->lock_shadow);
zebra_unlock (zh->lock_normal);
if (zebra_commit (zh))
if (val == 'd')
{
+ /* shadow area is dirty and so we must throw it away */
yaz_log(YLOG_WARN, "previous transaction didn't reach commit");
clean_only = 1;
}
ZEBRA_RES zebra_add_record(ZebraHandle zh,
const char *buf, int buf_size)
{
- return zebra_update_record(zh, 0, 0 /* sysno */, 0, 0, buf, buf_size, 0);
+ return zebra_update_record(zh, 0, 0 /* sysno */, 0, 0, buf, buf_size, 1);
}
ZEBRA_RES zebra_insert_record(ZebraHandle zh,
recordType,
sysno,
match, fname,
- 0,
+ 1,
0); /* allow_update */
if (zebra_end_trans(zh) != ZEBRA_OK)
{
Z_RPNQuery *query;
ODR odr;
+
ZEBRA_CHECK_HANDLE(zh);
odr = odr_createmem(ODR_ENCODE);