cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From giac...@apache.org
Subject svn commit: r602900 - in /cocoon/trunk: blocks/cocoon-lucene/cocoon-lucene-impl/ blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/components/search/ blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/transfor...
Date Mon, 10 Dec 2007 13:41:29 GMT
Author: giacomo
Date: Mon Dec 10 05:41:28 2007
New Revision: 602900

URL: http://svn.apache.org/viewvc?rev=602900&view=rev
Log:
upgrade cocoon-lucene block to lucene 2.2.0

Modified:
    cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/pom.xml
    cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/components/search/LuceneIndexContentHandler.java
    cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/components/search/SimpleLuceneCocoonIndexerImpl.java
    cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/components/search/SimpleLuceneCocoonSearcherImpl.java
    cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/components/search/SimpleLuceneXMLIndexerImpl.java
    cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/transformation/LuceneIndexTransformer.java
    cocoon/trunk/parent/pom.xml

Modified: cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/pom.xml?rev=602900&r1=602899&r2=602900&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/pom.xml (original)
+++ cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/pom.xml Mon Dec 10 05:41:28 2007
@@ -54,8 +54,8 @@
       <artifactId>cocoon-core</artifactId>
     </dependency>
     <dependency>
-      <groupId>lucene</groupId>
-      <artifactId>lucene</artifactId>
+      <groupId>org.apache.lucene</groupId>
+      <artifactId>lucene-core</artifactId>
     </dependency>
     <dependency>
       <groupId>javax.servlet</groupId>

Modified: cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/components/search/LuceneIndexContentHandler.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/components/search/LuceneIndexContentHandler.java?rev=602900&r1=602899&r2=602900&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/components/search/LuceneIndexContentHandler.java
(original)
+++ cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/components/search/LuceneIndexContentHandler.java
Mon Dec 10 05:41:28 2007
@@ -18,6 +18,8 @@
 
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
+import org.apache.lucene.document.Field.Index;
+import org.apache.lucene.document.Field.Store;
 import org.xml.sax.Attributes;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.Locator;
@@ -103,7 +105,7 @@
     }
 
     public void endDocument() {
-        bodyDocument.add(Field.UnStored(LuceneXMLIndexer.BODY_FIELD, bodyText.toString()));
+        bodyDocument.add(new Field(LuceneXMLIndexer.BODY_FIELD, bodyText.toString(), Field.Store.NO,
Field.Index.TOKENIZED));
     }
 
     public void endElement(String namespaceURI, String localName, String qName) {
@@ -119,7 +121,7 @@
 
             String atts_lname = atts.getLocalName(i);
             String atts_value = atts.getValue(i);
-            bodyDocument.add(Field.UnStored(lname + "@" + atts_lname, atts_value));
+            bodyDocument.add(new Field(lname + "@" + atts_lname, atts_value, Field.Store.NO,
Field.Index.TOKENIZED));
             if (attributesToText) {
                 text.append(' ');
                 text.append(atts_value);
@@ -130,9 +132,9 @@
 
         if (text != null && text.length() > 0) {
             if (isFieldTag(lname)) {
-                bodyDocument.add(Field.UnIndexed(lname, text.toString()));
+                bodyDocument.add(new Field(lname, text.toString(), Field.Store.YES, Field.Index.NO));
             }
-            bodyDocument.add(Field.UnStored(lname, text.toString()));
+            bodyDocument.add(new Field(lname, text.toString(), Field.Store.NO, Field.Index.TOKENIZED));
         }
     }
 

Modified: cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/components/search/SimpleLuceneCocoonIndexerImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/components/search/SimpleLuceneCocoonIndexerImpl.java?rev=602900&r1=602899&r2=602900&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/components/search/SimpleLuceneCocoonIndexerImpl.java
(original)
+++ cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/components/search/SimpleLuceneCocoonIndexerImpl.java
Mon Dec 10 05:41:28 2007
@@ -97,7 +97,7 @@
 
         try {
             writer = new IndexWriter(index, analyzer, create);
-            writer.mergeFactor = this.mergeFactor;
+            writer.setMergeFactor(this.mergeFactor);
 
             getCocoonCrawler().crawl(base_url);
 
@@ -178,7 +178,7 @@
          */
         public void deleteAllStaleDocuments() throws IOException {
             while (uidIter.term() != null && uidIter.term().field() == "uid") {
-                reader.delete(uidIter.term());
+                reader.deleteDocuments(uidIter.term());
                 uidIter.next();
             }
         }
@@ -193,7 +193,7 @@
          */
         public void deleteModifiedDocuments(String uid) throws IOException {
             while (documentHasBeenModified(uidIter.term(), uid)) {
-                reader.delete(uidIter.term());
+                reader.deleteDocuments(uidIter.term());
                 uidIter.next();
             }
             if (documentHasNotBeenModified(uidIter.term(), uid)) {

Modified: cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/components/search/SimpleLuceneCocoonSearcherImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/components/search/SimpleLuceneCocoonSearcherImpl.java?rev=602900&r1=602899&r2=602900&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/components/search/SimpleLuceneCocoonSearcherImpl.java
(original)
+++ cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/components/search/SimpleLuceneCocoonSearcherImpl.java
Mon Dec 10 05:41:28 2007
@@ -195,7 +195,8 @@
         }
 
         try {
-            Query query = QueryParser.parse(query_string, default_field, analyzer);
+            final QueryParser parser = new QueryParser(default_field, analyzer);
+            Query query = parser.parse(query_string);
 
             // release index searcher for each new search
             releaseIndexSearcher();

Modified: cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/components/search/SimpleLuceneXMLIndexerImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/components/search/SimpleLuceneXMLIndexerImpl.java?rev=602900&r1=602899&r2=602900&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/components/search/SimpleLuceneXMLIndexerImpl.java
(original)
+++ cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/components/search/SimpleLuceneXMLIndexerImpl.java
Mon Dec 10 05:41:28 2007
@@ -31,6 +31,8 @@
 import org.apache.lucene.document.DateField;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
+import org.apache.lucene.document.Field.Index;
+import org.apache.lucene.document.Field.Store;
 import org.springframework.beans.factory.InitializingBean;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
@@ -175,9 +177,9 @@
                 Iterator it = luceneIndexContentHandler.iterator();
                 while (it.hasNext()) {
                     Document d = (Document) it.next();
-                    d.add(Field.UnIndexed(URL_FIELD, url.toString()));
+                    d.add(new Field(URL_FIELD, url.toString(), Field.Store.YES, Field.Index.NO));
                     // store ... false, index ... true, token ... false
-                    d.add(new Field(UID_FIELD, uid(contentURLConnection), false, true, false));
+                    d.add(new Field(UID_FIELD, uid(contentURLConnection), Field.Store.NO,
Field.Index.UN_TOKENIZED));
                 }
 
                 return luceneIndexContentHandler.allDocuments();

Modified: cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/transformation/LuceneIndexTransformer.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/transformation/LuceneIndexTransformer.java?rev=602900&r1=602899&r2=602900&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/transformation/LuceneIndexTransformer.java
(original)
+++ cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-impl/src/main/java/org/apache/cocoon/transformation/LuceneIndexTransformer.java
Mon Dec 10 05:41:28 2007
@@ -35,8 +35,10 @@
 import org.apache.excalibur.source.impl.validity.NOPValidity;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.Field.Index;
+import org.apache.lucene.document.Field.Store;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.store.Directory;
@@ -409,13 +411,12 @@
         } else if (processing == STATE_DOCUMENT) {
             if (LUCENE_URI.equals(namespaceURI) && LUCENE_DOCUMENT_ELEMENT.equals(localName))
{
                 // End document processing
-                this.bodyDocument.add(Field.UnStored(LuceneXMLIndexer.BODY_FIELD, this.bodyText.toString()));
+                this.bodyDocument.add(new Field(LuceneXMLIndexer.BODY_FIELD, this.bodyText.toString(),
Field.Store.NO, Field.Index.TOKENIZED));
                 this.bodyText = null;
 
-                this.bodyDocument.add(Field.UnIndexed(LuceneXMLIndexer.URL_FIELD, this.bodyDocumentURL));
+                this.bodyDocument.add(new Field(LuceneXMLIndexer.URL_FIELD, this.bodyDocumentURL,
Field.Store.YES, Field.Index.NO));
                 // store: false, index: true, tokenize: false
-                this.bodyDocument.add(new Field(LuceneXMLIndexer.UID_FIELD, uid(this.bodyDocumentURL),
false, true,
-                        false));
+                this.bodyDocument.add(new Field(LuceneXMLIndexer.UID_FIELD, uid(this.bodyDocumentURL),
Field.Store.NO, Field.Index.UN_TOKENIZED));
                 try {
                     reindexDocument();
                 } catch (IOException e) {
@@ -447,7 +448,7 @@
 
                     String atts_lname = atts.getLocalName(i);
                     String atts_value = atts.getValue(i);
-                    bodyDocument.add(Field.UnStored(localName + "@" + atts_lname, atts_value));
+                    bodyDocument.add(new Field(localName + "@" + atts_lname, atts_value,
Field.Store.NO, Field.Index.TOKENIZED));
                     if (attributesToText) {
                         text.append(atts_value);
                         text.append(' ');
@@ -459,9 +460,9 @@
                 boolean store = atts.getIndex(LUCENE_URI, LUCENE_ELEMENT_ATTR_STORE_VALUE)
!= -1;
                 if (text != null && text.length() > 0) {
                     if (store) {
-                        bodyDocument.add(Field.Text(localName, text.toString()));
+                        bodyDocument.add(new Field(localName, text.toString(), Field.Store.YES,
Field.Index.TOKENIZED));
                     } else {
-                        bodyDocument.add(Field.UnStored(localName, text.toString()));
+                        bodyDocument.add(new Field(localName, text.toString(), Field.Store.NO,
Field.Index.TOKENIZED));
                     }
                 }
             }
@@ -502,8 +503,8 @@
         Directory directory = LuceneCocoonHelper.getDirectory(indexDirectory, createIndex);
         Analyzer analyzer = LuceneCocoonHelper.getAnalyzer(queryConfiguration.analyzerClassname);
         this.writer = new IndexWriter(directory, analyzer, createIndex);
-        this.writer.mergeFactor = queryConfiguration.indexerMergeFactor;
-        this.writer.maxFieldLength = queryConfiguration.indexerMaxFieldLength;
+        this.writer.setMergeFactor(queryConfiguration.indexerMergeFactor);
+        this.writer.setMaxFieldLength(queryConfiguration.indexerMaxFieldLength);
     }
 
     private IndexReader openReader() throws IOException {
@@ -534,7 +535,7 @@
             // from the index before adding it
             try {
                 IndexReader reader = openReader();
-                reader.delete(new Term(LuceneXMLIndexer.UID_FIELD, uid(this.bodyDocumentURL)));
+                reader.deleteDocuments(new Term(LuceneXMLIndexer.UID_FIELD, uid(this.bodyDocumentURL)));
                 reader.close();
             } catch (IOException e) { /* ignore */
             }

Modified: cocoon/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/parent/pom.xml?rev=602900&r1=602899&r2=602900&view=diff
==============================================================================
--- cocoon/trunk/parent/pom.xml (original)
+++ cocoon/trunk/parent/pom.xml Mon Dec 10 05:41:28 2007
@@ -1818,9 +1818,9 @@
         <version>1.2.14</version>
       </dependency>
       <dependency>
-        <groupId>lucene</groupId>
-        <artifactId>lucene</artifactId>
-        <version>1.4.3</version>
+        <groupId>org.apache.lucene</groupId>
+        <artifactId>lucene-core</artifactId>
+        <version>2.2.0</version>
       </dependency>
       <dependency>
         <groupId>javax.mail</groupId>



Mime
View raw message