fixed 2 problems with john's code: publish_path shouldn't be used, and the
[mir.git] / source / mircoders / producer / IndexingProducerNode.java
index d207dfe..650c528 100755 (executable)
@@ -39,17 +39,15 @@ import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.store.FSDirectory;
 
-import freemarker.template.*;
-
 
 import mir.util.*;
+import mir.misc.*;
 import mir.log.*;
+import mir.entity.*;
+import mir.entity.adapter.*;
 import mir.producer.*;
-//import mir.generator.*;
 import mircoders.global.*;
 import mircoders.localizer.*;
-import mir.entity.*;
-import mir.entity.adapter.*;
 import mircoders.entity.*;
 import mircoders.storage.*;
 import mircoders.search.*;
@@ -74,9 +72,9 @@ public class IndexingProducerNode implements ProducerNode {
     long endTime;
 
     startTime = System.currentTimeMillis();
-    
-    
-    
+
+
+
     try {
       index = ParameterExpander.expandExpression(aValueMap, indexPath);
       data =  ParameterExpander.findValueForKey( aValueMap, contentKey );
@@ -92,9 +90,9 @@ public class IndexingProducerNode implements ProducerNode {
 
       // create an index here if one did not already exist
       if (! (IndexReader.indexExists(index))){
-       aLogger.error("Didn't find existing index, so I'm making one in "+index);
-       IndexWriter indexCreator = new IndexWriter(index,new StandardAnalyzer(),true);
-       indexCreator.close();
+        aLogger.error("Didn't find existing index, so I'm making one in "+index);
+        IndexWriter indexCreator = new IndexWriter(index,new StandardAnalyzer(),true);
+        indexCreator.close();
       }
 
       IndexUtil.unindexEntity((EntityContent) entity,index);
@@ -106,14 +104,14 @@ public class IndexingProducerNode implements ProducerNode {
       // Text is tokenized,stored, indexed
       // Unindexed is not tokenized or indexed, only stored
       // Unstored is tokenized and indexed, but not stored
-      
+
       //this initialization should go somewhere global like an xml file....
 
       (new KeywordSearchTerm("id","","id","","id")).index(theDoc,entity);
-      
+
       (new KeywordSearchTerm("webdb_create_formatted","search_date","webdb_create_formatted","webdb_create_formatted","webdb_create_formatted")).index(theDoc,entity);
-      
-      (new UnIndexedSearchTerm("","","","where","where")).indexValue(theDoc,entity.getValue("publish_path")+entity.getValue("id")+".shtml");
+
+      (new UnIndexedSearchTerm("","","","where","where")).indexValue(theDoc, StringUtil.webdbDate2path(entity.getValue("date"))+entity.getValue("id")+".shtml");
 
       (new TextSearchTerm("creator","search_creator","creator","creator","creator")).index(theDoc,entity);
       (new TextSearchTerm("title","search_title","title","title","title")).index(theDoc,entity);
@@ -121,17 +119,17 @@ public class IndexingProducerNode implements ProducerNode {
       (new UnIndexedSearchTerm("webdb_create","search_irrelevant","creationDate","creationDate","creationDate")).index(theDoc,entity);
 
       (new ContentSearchTerm("content_data","search_content","content","","")).indexValue(theDoc,
-                                                                                    entity.getValue("content_data")+ " "
-                                                                                    + entity.getValue("description")+ " "
-                                                                                    + entity.getValue("title")
-                                                                                    );
+                                                                                     entity.getValue("content_data")+ " "
+                                                                                     + entity.getValue("description")+ " "
+                                                                                     + entity.getValue("title")
+                                                                                     );
 
       (new TopicSearchTerm()).index(theDoc,entity);
 
       (new ImagesSearchTerm()).index(theDoc,entity);
-      
+
       (new AudioSearchTerm()).index(theDoc,entity);
-      
+
       (new VideoSearchTerm()).index(theDoc,entity);