-/* $Id: retrieve.c,v 1.31 2005-06-07 11:36:38 adam Exp $
- Copyright (C) 1995-2005
+/* $Id: retrieve.c,v 1.43 2006-08-14 10:40:15 adam Exp $
+ Copyright (C) 1995-2006
Index Data ApS
This file is part of the Zebra server.
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 <stdio.h>
#ifdef WIN32
#include <io.h>
#include <process.h>
-#else
+#endif
+#if HAVE_UNISTD_H
#include <unistd.h>
#endif
if (comp && comp->which == Z_RecordComp_simple &&
comp->u.simple->which == Z_ElementSetNames_generic &&
+ !strcmp (comp->u.simple->u.generic, "_storekeys_"))
+ {
+ WRBUF wrbuf = wrbuf_alloc();
+ zebra_rec_keys_t keys = zebra_rec_keys_open();
+ zebra_rec_keys_set_buf(keys,
+ rec->info[recInfo_delKeys],
+ rec->size[recInfo_delKeys],
+ 0);
+ if (zebra_rec_keys_rewind(keys))
+ {
+ size_t slen;
+ const char *str;
+ struct it_key key_in;
+ while(zebra_rec_keys_read(keys, &str, &slen, &key_in))
+ {
+ int i;
+ int ord = CAST_ZINT_TO_INT(key_in.mem[0]);
+ int index_type;
+ const char *db = 0;
+ int set = 0;
+ int use = 0;
+ const char *string_index = 0;
+ char dst_buf[IT_MAX_WORD];
+
+ zebraExplain_lookup_ord(zh->reg->zei, ord, &index_type, &db,
+ &string_index);
+
+ if (string_index)
+ wrbuf_printf(wrbuf, "%s", string_index);
+ else
+ wrbuf_printf(wrbuf, "set=%d,use=%d", set, use);
+
+ zebra_term_untrans(zh, index_type, dst_buf, str);
+ wrbuf_printf(wrbuf, " %s", dst_buf);
+
+ for (i = 1; i < key_in.len; i++)
+ wrbuf_printf(wrbuf, " " ZINT_FORMAT, key_in.mem[i]);
+ wrbuf_printf(wrbuf, "\n");
+
+ }
+ }
+ *output_format = VAL_SUTRS;
+ *rec_lenp = wrbuf_len(wrbuf);
+ *rec_bufp = odr_malloc(stream, *rec_lenp);
+ memcpy(*rec_bufp, wrbuf_buf(wrbuf), *rec_lenp);
+ wrbuf_free(wrbuf, 1);
+ zebra_rec_keys_close(keys);
+ return 0;
+ }
+ if (comp && comp->which == Z_RecordComp_simple &&
+ comp->u.simple->which == Z_ElementSetNames_generic &&
!strcmp (comp->u.simple->u.generic, "R"))
{
raw_mode = 1;
}
}
retrieveCtrl.localno = sysno;
+ retrieveCtrl.staticrank = recordAttr->staticrank;
retrieveCtrl.score = score;
retrieveCtrl.recordSize = recordAttr->recordSize;
retrieveCtrl.odr = stream;
if (1)
{
/* snippets code */
- struct recKeys reckeys;
zebra_snippets *snippet;
- reckeys.buf = rec->info[recInfo_delKeys];
- reckeys.buf_used = rec->size[recInfo_delKeys];
- zebra_snippets_rec_keys(zh, &reckeys, retrieveCtrl.doc_snippet);
+ zebra_rec_keys_t reckeys = zebra_rec_keys_open();
+
+ zebra_rec_keys_set_buf(reckeys,
+ rec->info[recInfo_delKeys],
+ rec->size[recInfo_delKeys],
+ 0);
+ zebra_snippets_rec_keys(zh, reckeys, retrieveCtrl.doc_snippet);
+ zebra_rec_keys_close(reckeys);
+#if 0
+ /* for debugging purposes */
yaz_log(YLOG_LOG, "DOC SNIPPET:");
zebra_snippets_log(retrieveCtrl.doc_snippet, YLOG_LOG);
yaz_log(YLOG_LOG, "HIT SNIPPET:");
zebra_snippets_log(retrieveCtrl.hit_snippet, YLOG_LOG);
-
+#endif
snippet = zebra_snippets_window(retrieveCtrl.doc_snippet,
retrieveCtrl.hit_snippet,
10);
-
+#if 0
+ /* for debugging purposes */
yaz_log(YLOG_LOG, "WINDOW SNIPPET:");
zebra_snippets_log(snippet, YLOG_LOG);
-
+#endif
(*rt->retrieve)(clientData, &retrieveCtrl);
zebra_snippets_destroy(snippet);
*addinfo = retrieveCtrl.addinfo;
return retrieveCtrl.diagnostic;
}
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+