You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by mi...@apache.org on 2004/07/29 07:49:24 UTC

cvs commit: cocoon-lenya/src/java/org/apache/lenya/cms/task LuceneTask.java

michi       2004/07/28 22:49:24

  Added:       src/java/org/apache/lenya/cms/task LuceneTask.java
  Log:
  incrementally indexing of a single document started
  
  Revision  Changes    Path
  1.1                  cocoon-lenya/src/java/org/apache/lenya/cms/task/LuceneTask.java
  
  Index: LuceneTask.java
  ===================================================================
  /* $Id: LuceneTask.java,v 1.1 2004/07/29 05:49:24 michi Exp $  */
  
  package org.apache.lenya.cms.task;
  
  import org.apache.log4j.Category;
  
  import java.io.File;
  
  import org.apache.lenya.lucene.index.Index;
  import org.apache.lenya.lucene.index.Indexer;
  
  public class LuceneTask extends AbstractTask {
      Category log = Category.getInstance(LuceneTask.class);
  
      /**
       * @see org.apache.lenya.cms.task.Task#execute(java.lang.String)
       */
      public void execute(String servletContextPath) throws ExecutionException {
          try {
              //outputParameters();
  
              log.debug("Servlet context path: " + servletContextPath);
  
              String publicationId = getParameters().getParameter("publication-id");
              log.error("Publication ID: " + publicationId);
  
              String files = getParameters().getParameter("properties.files2index");
              log.error("Files 2 index: " + files);
  
              String luceneConfig = getParameters().getParameter("config");
              log.debug("Lucene configuration: " + luceneConfig);
  
              String luceneConfigAbsolutePath = servletContextPath + File.separator + "lenya" + File.separator + "pubs" + File.separator + publicationId  + File.separator + luceneConfig;
              log.error("Lucene configuration: " + luceneConfigAbsolutePath);
  
              Indexer indexer = Index.getIndexer(luceneConfigAbsolutePath);
  	    indexer.indexDocument(new File(files));
          } catch (Exception e) {
              log.error("" + e);
          }
      }
  
      /**
       * Output parameters for debugging
       */
      public void outputParameters() throws Exception {
          String[] names = getParameters().getNames();
          for (int i = 0; i < names.length; i++) {
              log.error("Name: " + names[i]);
              log.error("Value: " + getParameters().getParameter(names[i]));
          }
      }
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org