X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fextract.c;h=f92ca7f932421d38a6640e8b9a72aad576a1d06f;hb=d8b7f92dc036c81ed51a5f22b8c5bc9a5ae74487;hp=fc2205f9440093208ae249b2be2877cffc2d14d0;hpb=34552d7bc714468512b1873f1d6b75608d6b4655;p=idzebra-moved-to-github.git diff --git a/index/extract.c b/index/extract.c index fc2205f..f92ca7f 100644 --- a/index/extract.c +++ b/index/extract.c @@ -1,4 +1,4 @@ -/* $Id: extract.c,v 1.198 2005-11-09 11:51:29 adam Exp $ +/* $Id: extract.c,v 1.200 2005-12-09 10:45:04 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -586,7 +586,7 @@ static int file_extract_record(ZebraHandle zh, { yaz_log (YLOG_LOG, "delete %s %s " PRINTF_OFF_T, zh->m_record_type, fname, recordOffset); - yaz_log (YLOG_WARN, "cannot delete file above, storeKeys false"); + yaz_log (YLOG_WARN, "cannot delete file above, storeKeys false (1)"); } else { @@ -604,29 +604,19 @@ static int file_extract_record(ZebraHandle zh, } else { - /* record going to be updated */ - if (zebra_rec_keys_empty(delkeys)) - { + /* flush new keys for sort&search etc */ + if (zh->records_processed < zh->m_file_verbose_limit) yaz_log (YLOG_LOG, "update %s %s " PRINTF_OFF_T, zh->m_record_type, fname, recordOffset); - yaz_log (YLOG_WARN, "cannot update file above, storeKeys false"); - } - else - { - /* flush new keys for sort&search etc */ - if (zh->records_processed < zh->m_file_verbose_limit) - yaz_log (YLOG_LOG, "update %s %s " PRINTF_OFF_T, - zh->m_record_type, fname, recordOffset); - recordAttr->staticrank = extractCtrl.staticrank; + recordAttr->staticrank = extractCtrl.staticrank; #if NATTR - extract_flushSortKeys (zh, *sysno, 1, zh->reg->sortKeys); + extract_flushSortKeys (zh, *sysno, 1, zh->reg->sortKeys); #else - extract_flushSortKeys (zh, *sysno, 1, &zh->reg->sortKeys); + extract_flushSortKeys (zh, *sysno, 1, &zh->reg->sortKeys); #endif - extract_flushRecordKeys (zh, *sysno, 1, zh->reg->keys, + extract_flushRecordKeys (zh, *sysno, 1, zh->reg->keys, recordAttr->staticrank); - zh->records_updated++; - } + zh->records_updated++; } zebra_rec_keys_close(delkeys); #if NATTR @@ -855,6 +845,7 @@ ZEBRA_RES buffer_extract_record(ZebraHandle zh, int force_update, int allow_update) { + SYSNO sysno0 = 0; RecordAttr *recordAttr; struct recExtractCtrl extractCtrl; int r; @@ -952,14 +943,14 @@ ZEBRA_RES buffer_extract_record(ZebraHandle zh, yaz_log (YLOG_WARN, "extract error: no such filter"); return ZEBRA_FAIL; } - /* match criteria */ - matchStr = NULL; if (extractCtrl.match_criteria[0]) match_criteria = extractCtrl.match_criteria; - if (! *sysno) { - char *rinfo; + if (!sysno) { + + sysno = &sysno0; + if (match_criteria && *match_criteria) { matchStr = match_criteria; } else { @@ -974,7 +965,7 @@ ZEBRA_RES buffer_extract_record(ZebraHandle zh, } } if (matchStr) { - rinfo = dict_lookup (zh->reg->matchDict, matchStr); + char *rinfo = dict_lookup (zh->reg->matchDict, matchStr); if (rinfo) { assert(*rinfo == sizeof(*sysno)); @@ -995,8 +986,7 @@ ZEBRA_RES buffer_extract_record(ZebraHandle zh, /* new record */ if (delete_flag) { - if (show_progress) - yaz_log (YLOG_LOG, "delete %s %s %ld", recordType, + yaz_log (YLOG_LOG, "delete %s %s %ld", recordType, pr_fname, (long) recordOffset); yaz_log (YLOG_WARN, "cannot delete record above (seems new)"); return ZEBRA_FAIL; @@ -1041,8 +1031,7 @@ ZEBRA_RES buffer_extract_record(ZebraHandle zh, if (!allow_update) { - if (show_progress) - yaz_log (YLOG_LOG, "skipped %s %s %ld", + yaz_log (YLOG_LOG, "skipped %s %s %ld", recordType, pr_fname, (long) recordOffset); logRecord(zh); return ZEBRA_FAIL; @@ -1079,13 +1068,10 @@ ZEBRA_RES buffer_extract_record(ZebraHandle zh, /* record going to be deleted */ if (zebra_rec_keys_empty(delkeys)) { - if (show_progress) - { - yaz_log (YLOG_LOG, "delete %s %s %ld", recordType, - pr_fname, (long) recordOffset); - yaz_log (YLOG_WARN, "cannot delete file above, " - "storeKeys false"); - } + yaz_log (YLOG_LOG, "delete %s %s %ld", recordType, + pr_fname, (long) recordOffset); + yaz_log (YLOG_WARN, "cannot delete file above, " + "storeKeys false (3)"); } else { @@ -1103,31 +1089,18 @@ ZEBRA_RES buffer_extract_record(ZebraHandle zh, } else { - /* record going to be updated */ - if (zebra_rec_keys_empty(delkeys)) - { - if (show_progress) - { - yaz_log (YLOG_LOG, "update %s %s %ld", recordType, - pr_fname, (long) recordOffset); - yaz_log (YLOG_WARN, "cannot update file above, storeKeys false"); - } - } - else - { - if (show_progress) + if (show_progress) yaz_log (YLOG_LOG, "update %s %s %ld", recordType, pr_fname, (long) recordOffset); - recordAttr->staticrank = extractCtrl.staticrank; + recordAttr->staticrank = extractCtrl.staticrank; #if NATTR - extract_flushSortKeys (zh, *sysno, 1, zh->reg->sortKeys); + extract_flushSortKeys (zh, *sysno, 1, zh->reg->sortKeys); #else - extract_flushSortKeys (zh, *sysno, 1, &zh->reg->sortKeys); + extract_flushSortKeys (zh, *sysno, 1, &zh->reg->sortKeys); #endif - extract_flushRecordKeys (zh, *sysno, 1, zh->reg->keys, + extract_flushRecordKeys (zh, *sysno, 1, zh->reg->keys, recordAttr->staticrank); - zh->records_updated++; - } + zh->records_updated++; } zebra_rec_keys_close(delkeys); #if NATTR