Lucene.Net
3.0.3
Lucene.Net is a port of the Lucene search engine library, written in C# and targeted at .NET runtime users.
Main Page
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Properties
Pages
core
Index
IndexDeletionPolicy.cs
Go to the documentation of this file.
1
/*
2
* Licensed to the Apache Software Foundation (ASF) under one or more
3
* contributor license agreements. See the NOTICE file distributed with
4
* this work for additional information regarding copyright ownership.
5
* The ASF licenses this file to You under the Apache License, Version 2.0
6
* (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*/
17
18
using
System;
19
using
System.Collections.Generic;
20
21
namespace
Lucene.Net.Index
22
{
23
24
/// <summary> <p/>Expert: policy for deletion of stale <see cref="IndexCommit">index commits</see>.
25
///
26
/// <p/>Implement this interface, and pass it to one
27
/// of the <see cref="IndexWriter" /> or <see cref="IndexReader" />
28
/// constructors, to customize when older
29
/// <see cref="IndexCommit">point-in-time commits</see>
30
/// are deleted from the index directory. The default deletion policy
31
/// is <see cref="KeepOnlyLastCommitDeletionPolicy" />, which always
32
/// removes old commits as soon as a new commit is done (this
33
/// matches the behavior before 2.2).<p/>
34
///
35
/// <p/>One expected use case for this (and the reason why it
36
/// was first created) is to work around problems with an
37
/// index directory accessed via filesystems like NFS because
38
/// NFS does not provide the "delete on last close" semantics
39
/// that Lucene's "point in time" search normally relies on.
40
/// By implementing a custom deletion policy, such as "a
41
/// commit is only removed once it has been stale for more
42
/// than X minutes", you can give your readers time to
43
/// refresh to the new commit before <see cref="IndexWriter" />
44
/// removes the old commits. Note that doing so will
45
/// increase the storage requirements of the index. See <a
46
/// target="top"
47
/// href="http://issues.apache.org/jira/browse/LUCENE-710">LUCENE-710</a>
48
/// for details.<p/>
49
/// </summary>
50
51
public
interface
IndexDeletionPolicy
52
{
53
54
/// <summary> <p/>This is called once when a writer is first
55
/// instantiated to give the policy a chance to remove old
56
/// commit points.<p/>
57
///
58
/// <p/>The writer locates all index commits present in the
59
/// index directory and calls this method. The policy may
60
/// choose to delete some of the commit points, doing so by
61
/// calling method <see cref="IndexCommit.Delete()" />
62
/// of <see cref="IndexCommit" />.<p/>
63
///
64
/// <p/><u>Note:</u> the last CommitPoint is the most recent one,
65
/// i.e. the "front index state". Be careful not to delete it,
66
/// unless you know for sure what you are doing, and unless
67
/// you can afford to lose the index content while doing that.
68
///
69
/// </summary>
70
/// <param name="commits">List of current
71
/// <see cref="IndexCommit">point-in-time commits</see>,
72
/// sorted by age (the 0th one is the oldest commit).
73
/// </param>
74
void
OnInit<T>(IList<T> commits) where T :
IndexCommit
;
75
76
/// <summary>
77
/// <p>This is called each time the writer completed a commit.
78
/// This gives the policy a chance to remove old commit points
79
/// with each commit.</p>
80
///
81
/// <p>The policy may now choose to delete old commit points
82
/// by calling method <see cref="IndexCommit.Delete()"/>
83
/// of <see cref="IndexCommit" />.</p>
84
///
85
/// <p>This method is only called when <see cref="IndexWriter.Commit()"/>
86
/// or <see cref="IndexWriter.Close()"/> is called, or possibly not at
87
/// all if the <see cref="IndexWriter.Rollback()"/> is called.</p>
88
///
89
/// <p><u>Note:</u> the last CommitPoint is the most recent one,
90
/// i.e. the "front index state". Be careful not to delete it,
91
/// unless you know for sure what you are doing, and unless
92
/// you can afford to lose the index content while doing that.</p>
93
/// </summary>
94
/// <param name="commits">
95
/// List of <see cref="IndexCommit" />, sorted by age (the 0th one is the oldest commit).
96
/// </param>
97
void
OnCommit<T>(IList<T> commits) where T :
IndexCommit
;
98
}
99
}
Generated on Thu Jan 3 2013 02:34:11 for Lucene.Net by
1.8.3