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
Remove isamd. It's not been in use for a long time and isamb is better
[idzebra-moved-to-github.git]
/
index
/
retrieve.c
diff --git
a/index/retrieve.c
b/index/retrieve.c
index
0fc202a
..
909c41f
100644
(file)
--- a/
index/retrieve.c
+++ b/
index/retrieve.c
@@
-1,5
+1,5
@@
-/* $Id: retrieve.c,v 1.20 2002-08-02 19:26:55 adam Exp $
- Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
+/* $Id: retrieve.c,v 1.22 2004-08-04 08:35:23 adam Exp $
+ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
This file is part of the Zebra server.
Index Data Aps
This file is part of the Zebra server.
@@
-20,8
+20,6
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
02111-1307, USA.
*/
-
-
#include <stdio.h>
#include <assert.h>
#include <stdio.h>
#include <assert.h>
@@
-84,7
+82,7
@@
void zebra_record_int_end (void *fh, off_t off)
fc->offset_end = off;
}
fc->offset_end = off;
}
-int zebra_record_fetch (ZebraHandle zh, int sysno, int score, ODR stream,
+int zebra_record_fetch (ZebraHandle zh, SYSNO sysno, int score, ODR stream,
oid_value input_format, Z_RecordComposition *comp,
oid_value *output_format, char **rec_bufp,
int *rec_lenp, char **basenamep)
oid_value input_format, Z_RecordComposition *comp,
oid_value *output_format, char **rec_bufp,
int *rec_lenp, char **basenamep)
@@
-97,11
+95,12
@@
int zebra_record_fetch (ZebraHandle zh, int sysno, int score, ODR stream,
struct zebra_fetch_control fc;
RecordAttr *recordAttr;
void *clientData;
struct zebra_fetch_control fc;
RecordAttr *recordAttr;
void *clientData;
+ int raw_mode = 0;
rec = rec_get (zh->reg->records, sysno);
if (!rec)
{
rec = rec_get (zh->reg->records, sysno);
if (!rec)
{
- logf (LOG_DEBUG, "rec_get fail on sysno=%d", sysno);
+ logf (LOG_DEBUG, "rec_get fail on sysno=" ZINT_FORMAT, sysno);
*basenamep = 0;
return 14;
}
*basenamep = 0;
return 14;
}
@@
-117,7
+116,7
@@
int zebra_record_fetch (ZebraHandle zh, int sysno, int score, ODR stream,
comp->u.simple->which == Z_ElementSetNames_generic)
{
if (!strcmp (comp->u.simple->u.generic, "R"))
comp->u.simple->which == Z_ElementSetNames_generic)
{
if (!strcmp (comp->u.simple->u.generic, "R"))
- file_type = "text";
+ raw_mode = 1;
}
if (!(rt = recType_byName (zh->reg->recTypes,
file_type, subType, &clientData)))
}
if (!(rt = recType_byName (zh->reg->recTypes,
file_type, subType, &clientData)))
@@
-125,7
+124,7
@@
int zebra_record_fetch (ZebraHandle zh, int sysno, int score, ODR stream,
logf (LOG_WARN, "Retrieve: Cannot handle type %s", file_type);
return 14;
}
logf (LOG_WARN, "Retrieve: Cannot handle type %s", file_type);
return 14;
}
- logf (LOG_DEBUG, "retrieve localno=%d score=%d", sysno, score);
+ logf (LOG_DEBUG, "retrieve localno=" ZINT_FORMAT " score=%d", sysno,score);
retrieveCtrl.fh = &fc;
fc.fd = -1;
retrieveCtrl.fname = fname;
retrieveCtrl.fh = &fc;
fc.fd = -1;
retrieveCtrl.fname = fname;
@@
-138,6
+137,15
@@
int zebra_record_fetch (ZebraHandle zh, int sysno, int score, ODR stream,
fc.record_int_buf = rec->info[recInfo_storeData];
fc.record_int_pos = 0;
logf (LOG_DEBUG, "Internal retrieve. %d bytes", fc.record_int_len);
fc.record_int_buf = rec->info[recInfo_storeData];
fc.record_int_pos = 0;
logf (LOG_DEBUG, "Internal retrieve. %d bytes", fc.record_int_len);
+ if (raw_mode)
+ {
+ *output_format = VAL_SUTRS;
+ *rec_lenp = rec->size[recInfo_storeData];
+ *rec_bufp = (char *) odr_malloc(stream, *rec_lenp);
+ memcpy(*rec_bufp, rec->info[recInfo_storeData], *rec_lenp);
+ rec_rm (&rec);
+ return 0;
+ }
}
else
{
}
else
{
@@
-151,7
+159,6
@@
int zebra_record_fetch (ZebraHandle zh, int sysno, int score, ODR stream,
}
else
strcpy (full_rep, fname);
}
else
strcpy (full_rep, fname);
-
if ((fc.fd = open (full_rep, O_BINARY|O_RDONLY)) == -1)
{
if ((fc.fd = open (full_rep, O_BINARY|O_RDONLY)) == -1)
{
@@
-167,6
+174,16
@@
int zebra_record_fetch (ZebraHandle zh, int sysno, int score, ODR stream,
retrieveCtrl.tellf = zebra_record_ext_tell;
zebra_record_ext_seek (retrieveCtrl.fh, 0);
retrieveCtrl.tellf = zebra_record_ext_tell;
zebra_record_ext_seek (retrieveCtrl.fh, 0);
+ if (raw_mode)
+ {
+ *output_format = VAL_SUTRS;
+ *rec_lenp = recordAttr->recordSize;
+ *rec_bufp = (char *) odr_malloc(stream, *rec_lenp);
+ zebra_record_ext_read(&fc, *rec_bufp, *rec_lenp);
+ rec_rm (&rec);
+ close (fc.fd);
+ return 0;
+ }
}
retrieveCtrl.subType = subType;
retrieveCtrl.localno = sysno;
}
retrieveCtrl.subType = subType;
retrieveCtrl.localno = sysno;