Added method IndexWriter.addDocument(Document, Analyzer).

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@149999 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Doug Cutting 2003-07-11 22:13:13 +00:00
parent 8a9ebad004
commit 47dfbc2b6a
2 changed files with 14 additions and 0 deletions

View File

@ -12,6 +12,10 @@ $Id$
permitted to write files. This way folks can open and correctly
lock indexes which are read-only to them.
3. IndexWriter: added a new method, addDocument(Document, Analyzer),
permitting one to easily use different analyzers for different
documents in the same index.
1.3 RC1

View File

@ -212,6 +212,16 @@ public class IndexWriter {
* discarded.
*/
public void addDocument(Document doc) throws IOException {
addDocument(doc, analyzer);
}
/**
* Adds a document to this index, using the provided analyzer instead of the
* value of {@link #getAnalyzer()}. If the document contains more than
* {@link #maxFieldLength} terms for a given field, the remainder are
* discarded.
*/
public void addDocument(Document doc, Analyzer analyzer) throws IOException {
DocumentWriter dw =
new DocumentWriter(ramDirectory, analyzer, similarity, maxFieldLength);
String segmentName = newSegmentName();