4 // Copyright (C) 2005 Novell, Inc.
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
15 // The above copyright notice and this permission notice shall be included in all
16 // copies or substantial portions of the Software.
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 using System
.Collections
;
35 class MasterDeleteTool
{
37 static void Main (string[] args
)
39 string index_dir
= args
[0];
40 Uri uri_to_delete
= new Uri (args
[1], false);
42 if (! Directory
.Exists (index_dir
)) {
43 Console
.WriteLine ("No such directory: {0}", index_dir
);
47 LuceneDriver driver
= new LuceneDriver (index_dir
);
49 ICollection hits
= driver
.DoQueryByUri (uri_to_delete
);
51 if (hits
== null || hits
.Count
== 0) {
52 Console
.WriteLine ("Uri {0} not found in the index in {1}",
53 uri_to_delete
, index_dir
);
57 driver
.Remove (uri_to_delete
);
60 Console
.WriteLine ("Uri {0} deleted", uri_to_delete
);