pylucene 3.5.0-3
[pylucene.git] / lucene-java-3.5.0 / lucene / contrib / instantiated / src / java / org / apache / lucene / store / instantiated / package.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <!--
4  Licensed to the Apache Software Foundation (ASF) under one or more
5  contributor license agreements.  See the NOTICE file distributed with
6  this work for additional information regarding copyright ownership.
7  The ASF licenses this file to You under the Apache License, Version 2.0
8  (the "License"); you may not use this file except in compliance with
9  the License.  You may obtain a copy of the License at
10
11      http://www.apache.org/licenses/LICENSE-2.0
12
13  Unless required by applicable law or agreed to in writing, software
14  distributed under the License is distributed on an "AS IS" BASIS,
15  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  See the License for the specific language governing permissions and
17  limitations under the License.
18 -->
19 <head>
20   <title>InstantiatedIndex</title>
21 </head>
22 <body>
23 <p>InstantiatedIndex, alternative RAM store for small corpora.</p>
24
25 <p>@lucene.experimental</p>
26 <h2>Abstract</h2>
27
28 <p>
29   Represented as a coupled graph of class instances, this
30   all-in-memory index store implementation delivers search
31   results up to a 100 times faster than the file-centric RAMDirectory
32   at the cost of greater RAM consumption.
33 </p>
34
35 <h2>API</h2>
36
37 <p>
38   Just as the default store implementation, InstantiatedIndex
39   comes with an IndexReader and IndexWriter. The latter share
40   many method signatures with the file-centric IndexWriter.
41 </p>
42
43 <p>
44   It is also possible to load the content of another index
45   by passing an IndexReader to the InstantiatedIndex constructor.
46 </p>
47
48 <h2>Performance</h2>
49
50 <p>
51   At a few thousand ~160 characters long documents
52   InstantiatedIndex outperforms RAMDirectory some 50x,
53   15x at 100 documents of 2000 characters length,
54   and is linear to RAMDirectory at 10,000 documents of 2000 characters length.
55 </p>
56
57 <p>Mileage may vary depending on term saturation.</p>
58
59 <img src="doc-files/HitCollectionBench.jpg" alt="benchmark"/>
60
61 <p>
62   Populated with a single document InstantiatedIndex is almost, but not quite, as fast as MemoryIndex.    
63 </p>
64
65 <p>
66   It takes more or less the same time to populate an InstantiatedIndex
67   as it takes to populate a RAMDirectory. Hardly any effort has been put
68   in to optimizing the InstantiatedIndexWriter, only minimizing the amount
69   of time needed to write-lock the index has been considered.
70 </p>
71
72 <h2>Caveats</h2>
73 <ul>
74   <li>No locks! Consider using InstantiatedIndex as if it was immutable.</li>
75   <li>No documents with fields containing readers.</li>
76   <li>No field selection when retrieving documents, as all stored field are available in memory.</li>
77   <li>Any document returned must cloned if they are to be touched.</li>
78   <li>Norms array returned must not be touched.</li>
79 </ul>
80
81 <h2>Use cases</h2>
82
83 <p>
84   Could replace any small index that could do with greater response time.
85   spell check a priori index,
86   the index of new documents exposed to user search agent queries,
87   to compile classifiers in machine learning environments, etc.
88 </p>
89
90 <h2>Class diagram</h2>
91 <a href="doc-files/classdiagram.png"><img width="640px" height="480px" src="doc-files/classdiagram.png" alt="class diagram"></a>
92 <br/>
93 <a href="doc-files/classdiagram.uxf">Diagram</a> rendered using <a href="http://umlet.com">UMLet</a> 7.1.
94 </body>
95 </html>