You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by ot...@apache.org on 2002/09/15 02:22:05 UTC

cvs commit: jakarta-lucene-sandbox/contributions/webcrawler-LARM/src/de/lanlab/larm/storage LuceneStorage.java

otis        2002/09/14 17:22:05

  Modified:    contributions/webcrawler-LARM/src/de/lanlab/larm/storage
                        LuceneStorage.java
  Log:
  - Added APL.
  - Moved all attributes up.
  - Fixed weird class javadoc.
  - Made a few small mods and added FIXMEs.
  
  Revision  Changes    Path
  1.2       +77 -28    jakarta-lucene-sandbox/contributions/webcrawler-LARM/src/de/lanlab/larm/storage/LuceneStorage.java
  
  Index: LuceneStorage.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene-sandbox/contributions/webcrawler-LARM/src/de/lanlab/larm/storage/LuceneStorage.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LuceneStorage.java	18 Jun 2002 00:44:22 -0000	1.1
  +++ LuceneStorage.java	15 Sep 2002 00:22:05 -0000	1.2
  @@ -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.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 @@
           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 @@
           }
           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 @@
           }
           else
           {
  -            return def;
  +            return defaultValue;
           }
       }
   
  @@ -149,10 +198,9 @@
       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 @@
           }
           catch(IOException e)
           {
  +	    // FIXME: replace with logging
               System.err.println("IOException occured when adding document to Lucene index");
               e.printStackTrace();
           }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>