- Added APL.

- Moved all attributes up.
- Fixed weird class javadoc.
- Made a few small mods and added FIXMEs.


git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150824 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Otis Gospodnetic 2002-09-15 00:22:05 +00:00
parent 3252c4925a
commit e8dfbf2ace
1 changed files with 77 additions and 28 deletions

View File

@ -1,14 +1,60 @@
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Lucene" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Lucene", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package de.lanlab.larm.storage;
import de.lanlab.larm.util.WebDocument;
/**
* Title: LARM Lanlab Retrieval Machine Description: Copyright: Copyright (c)
* Company:
*
* @author
* @version 1.0
*/
import org.apache.lucene.index.*;
import org.apache.lucene.document.*;
import org.apache.lucene.analysis.*;
@ -16,18 +62,25 @@ import java.util.*;
import java.io.*;
/**
* Description of the Class
* FIXME document this class
* Title: LARM Lanlab Retrieval Machine Description: Copyright: Copyright (c)
* Company:
*
* @author Administrator
* @created 14. Juni 2002
* @version $Id$
*/
public class LuceneStorage implements DocumentStorage
{
public final static int INDEX = 1;
public final static int STORE = 2;
public final static int TOKEN = 4;
HashMap fieldInfos = new HashMap();
IndexWriter writer;
Analyzer analyzer;
String indexName;
private HashMap fieldInfos = new HashMap();
private IndexWriter writer;
private Analyzer analyzer;
private String indexName;
private boolean create;
/**
@ -80,14 +133,13 @@ public class LuceneStorage implements DocumentStorage
this.create = create;
}
boolean create;
/**
* Description of the Method
*/
public void open()
{
// FIXME: replace with logging
System.out.println("opening Lucene storage with index name " + indexName + ")");
try
{
@ -95,29 +147,26 @@ public class LuceneStorage implements DocumentStorage
}
catch(IOException e)
{
// FIXME: replace with logging
System.err.println("IOException occured when opening Lucene Index with index name '" + indexName + "'");
e.printStackTrace();
}
if(writer != null)
if (writer != null)
{
// FIXME: replace with logging
System.out.println("lucene storage opened successfully");
}
}
public final static int INDEX = 1;
public final static int STORE = 2;
public final static int TOKEN = 4;
/**
* Gets the fieldInfo attribute of the LuceneStorage object
*
* @param fieldName Description of the Parameter
* @param def Description of the Parameter
* @param defaultValue Description of the Parameter
* @return The fieldInfo value
*/
protected int getFieldInfo(String fieldName, int def)
protected int getFieldInfo(String fieldName, int defaultValue)
{
Integer info = (Integer) fieldInfos.get(fieldName);
if (info != null)
@ -126,7 +175,7 @@ public class LuceneStorage implements DocumentStorage
}
else
{
return def;
return defaultValue;
}
}
@ -149,10 +198,9 @@ public class LuceneStorage implements DocumentStorage
public WebDocument store(WebDocument webDoc)
{
//System.out.println("storing " + webDoc.getUrl());
boolean store;
boolean index;
boolean token;
store = index = token = false;
boolean store = false;
boolean index = false;
boolean token = false;
Document doc = new Document();
int flags;
@ -184,6 +232,7 @@ public class LuceneStorage implements DocumentStorage
}
catch(IOException e)
{
// FIXME: replace with logging
System.err.println("IOException occured when adding document to Lucene index");
e.printStackTrace();
}