From 8f7cd01d361d4c2ebb375b05c98eb9e82cae4a43 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 25 Mar 2003 19:56:01 +0000 Subject: [PATCH] Fix repositoryDelete so that it uses recordId setting --- index/main.c | 4 ++-- index/trav.c | 7 +++++-- index/zebraapi.c | 29 ++++++++++++++++++++++------- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/index/main.c b/index/main.c index 8a23e03..c721067 100644 --- a/index/main.c +++ b/index/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.102 2003-03-04 23:30:20 adam Exp $ +/* $Id: main.c,v 1.103 2003-03-25 19:56:01 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -178,7 +178,7 @@ int main (int argc, char **argv) } else if (!strcmp (arg, "clean")) { - assert (!"todo"); + zebra_clean (zh); } else if (!strcmp (arg, "stat") || !strcmp (arg, "status")) { diff --git a/index/trav.c b/index/trav.c index 267fedf..e5d39d7 100644 --- a/index/trav.c +++ b/index/trav.c @@ -1,4 +1,4 @@ -/* $Id: trav.c,v 1.41 2002-09-03 11:44:54 adam Exp $ +/* $Id: trav.c,v 1.42 2003-03-25 19:56:01 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -455,6 +455,9 @@ void repositoryUpdate (ZebraHandle zh) void repositoryDelete (ZebraHandle zh) { - repositoryExtractG (zh, 1, &zh->rGroup); + struct recordGroup *rGroup = &zh->rGroup; + groupRes (zh, rGroup); + assert (rGroup->path); + repositoryExtractG (zh, 1, rGroup); } diff --git a/index/zebraapi.c b/index/zebraapi.c index 01c6433..1ebc60d 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -1,4 +1,4 @@ -/* $Id: zebraapi.c,v 1.93 2003-03-13 04:25:17 pop Exp $ +/* $Id: zebraapi.c,v 1.94 2003-03-25 19:56:01 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003 Index Data Aps @@ -1389,7 +1389,7 @@ void zebra_repository_show (ZebraHandle zh) repositoryShow (zh); } -int zebra_commit (ZebraHandle zh) +static int zebra_commit_ex (ZebraHandle zh, int clean_only) { int seqno; char val; @@ -1422,13 +1422,18 @@ int zebra_commit (ZebraHandle zh) bf_cache (bfs, rval); if (bf_commitExists (bfs)) { - zebra_set_state (zh, 'c', seqno); - - logf (LOG_LOG, "commit start"); - bf_commitExec (bfs); + if (clean_only) + zebra_set_state (zh, 'd', seqno); + else + { + zebra_set_state (zh, 'c', seqno); + + logf (LOG_LOG, "commit start"); + bf_commitExec (bfs); #ifndef WIN32 - sync (); + sync (); #endif + } logf (LOG_LOG, "commit clean"); bf_commitClean (bfs, rval); seqno++; @@ -1445,6 +1450,16 @@ int zebra_commit (ZebraHandle zh) return 0; } +int zebra_clean (ZebraHandle zh) +{ + zebra_commit_ex(zh, 1); +} + +int zebra_commit (ZebraHandle zh) +{ + zebra_commit_ex(zh, 0); +} + int zebra_init (ZebraHandle zh) { const char *rval; -- 1.7.10.4