Upgrading to latest stable Apache lucene version
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1405428 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
+3
-1
@@ -4,7 +4,9 @@
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="applications/content/lib/fontbox-1.4.0.jar"/>
|
||||
<classpathentry kind="lib" path="applications/content/lib/jempbox-1.4.0.jar"/>
|
||||
<classpathentry kind="lib" path="applications/content/lib/lucene-core-3.6.1.jar"/>
|
||||
<classpathentry kind="lib" path="applications/content/lib/lucene-analyzers-common-4.0.0.jar"/>
|
||||
<classpathentry kind="lib" path="applications/content/lib/lucene-core-4.0.0.jar"/>
|
||||
<classpathentry kind="lib" path="applications/content/lib/lucene-queryparser-4.0.0.jar"/>
|
||||
<classpathentry kind="lib" path="applications/content/lib/pdfbox-1.4.0.jar"/>
|
||||
<classpathentry kind="lib" path="applications/content/lib/dom4j-1.6.1.jar"/>
|
||||
<classpathentry kind="lib" path="applications/content/lib/poi-3.8-20120326.jar"/>
|
||||
|
||||
@@ -104,7 +104,9 @@ ofbiz/trunk/framework/geronimo/lib/geronimo-connector-2.1.1.jar
|
||||
ofbiz/trunk/framework/geronimo/lib/geronimo-transaction-2.1.1.jar
|
||||
ofbiz/trunk/applications/content/lib/fontbox-1.4.0.jar
|
||||
ofbiz/trunk/applications/content/lib/jempbox-1.4.0.jar
|
||||
ofbiz/trunk/applications/content/lib/lucene-core-3.6.1.jar
|
||||
ofbiz/trunk/applications/content/lib/lucene-analyzers-common-4.0.0.jar
|
||||
ofbiz/trunk/applications/content/lib/lucene-core-4.0.0.jar
|
||||
ofbiz/trunk/applications/content/lib/lucene-queryparser-4.0.0.jar
|
||||
ofbiz/trunk/applications/content/lib/pdfbox-1.4.0.jar
|
||||
ofbiz/trunk/applications/content/lib/poi-3.8-20120326.jar
|
||||
ofbiz/trunk/applications/content/lib/poi-ooxml-3.8-20120326.jar
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -41,9 +41,9 @@ import org.ofbiz.service.LocalDispatcher;
|
||||
|
||||
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.apache.lucene.document.Field.TermVector;
|
||||
import org.apache.lucene.document.StringField;
|
||||
import org.apache.lucene.document.TextField;
|
||||
|
||||
/**
|
||||
* ContentDocument Class
|
||||
@@ -76,7 +76,7 @@ public class ContentDocument {
|
||||
// make a new, empty document
|
||||
doc = new Document();
|
||||
String contentId = content.getString("contentId");
|
||||
doc.add(new Field("contentId", contentId, Store.YES, Index.NOT_ANALYZED, TermVector.NO));
|
||||
doc.add(new StringField("contentId", contentId, Store.YES));
|
||||
// Add the last modified date of the file a field named "modified". Use a
|
||||
// Keyword field, so that it's searchable, but so that no attempt is
|
||||
// made to tokenize the field into words.
|
||||
@@ -85,14 +85,14 @@ public class ContentDocument {
|
||||
modDate = (Timestamp) content.get("createdDate");
|
||||
}
|
||||
if (modDate != null) {
|
||||
doc.add(new Field("modified", modDate.toString(), Store.YES, Index.NOT_ANALYZED, TermVector.NO));
|
||||
doc.add(new StringField("modified", modDate.toString(), Store.YES));
|
||||
}
|
||||
String contentName = content.getString("contentName");
|
||||
if (UtilValidate.isNotEmpty(contentName))
|
||||
doc.add(new Field("title", contentName, Store.YES, Index.ANALYZED, TermVector.NO));
|
||||
doc.add(new TextField("title", contentName, Store.YES));
|
||||
String description = content.getString("description");
|
||||
if (UtilValidate.isNotEmpty(description))
|
||||
doc.add(new Field("description", description, Store.YES, Index.ANALYZED, TermVector.NO));
|
||||
doc.add(new TextField("description", description, Store.YES));
|
||||
List<String> ancestorList = FastList.newInstance();
|
||||
Delegator delegator = content.getDelegator();
|
||||
ContentWorker.getContentAncestryAll(delegator, contentId, "WEB_SITE_PUB_PT", "TO", ancestorList);
|
||||
@@ -100,7 +100,7 @@ public class ContentDocument {
|
||||
//Debug.logInfo("in ContentDocument, ancestorString:" + ancestorString,
|
||||
// module);
|
||||
if (UtilValidate.isNotEmpty(ancestorString)) {
|
||||
Field field = new Field("site", ancestorString, Store.NO, Index.ANALYZED, TermVector.NO);
|
||||
Field field = new StringField("site", ancestorString, Store.NO);
|
||||
//Debug.logInfo("in ContentDocument, field:" + field.stringValue(),
|
||||
// module);
|
||||
doc.add(field);
|
||||
@@ -163,7 +163,7 @@ public class ContentDocument {
|
||||
}
|
||||
//Debug.logInfo("in DataResourceDocument, text:" + text, module);
|
||||
if (UtilValidate.isNotEmpty(text)) {
|
||||
Field field = new Field("content", text, Store.NO, Index.ANALYZED, TermVector.NO);
|
||||
Field field = new TextField("content", text, Store.NO);
|
||||
//Debug.logInfo("in ContentDocument, field:" + field.stringValue(), module);
|
||||
doc.add(field);
|
||||
}
|
||||
@@ -184,7 +184,7 @@ public class ContentDocument {
|
||||
String featureString = StringUtil.join(featureList, " ");
|
||||
//Debug.logInfo("in ContentDocument, featureString:" + featureString, module);
|
||||
if (UtilValidate.isNotEmpty(featureString)) {
|
||||
Field field = new Field("feature", featureString, Store.NO, Index.ANALYZED, TermVector.NO);
|
||||
Field field = new TextField("feature", featureString, Store.NO);
|
||||
doc.add(field);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -34,10 +34,9 @@ import org.ofbiz.entity.GenericEntityException;
|
||||
import org.ofbiz.entity.GenericValue;
|
||||
|
||||
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.apache.lucene.document.Field.TermVector;
|
||||
import org.apache.lucene.document.StringField;
|
||||
import org.apache.lucene.document.TextField;
|
||||
|
||||
/**
|
||||
* DataResourceDocument Class
|
||||
@@ -60,7 +59,7 @@ public class DataResourceDocument {
|
||||
// make a new, empty document
|
||||
doc = new Document();
|
||||
|
||||
doc.add(new Field("dataResourceId", id, Store.YES, Index.NOT_ANALYZED, TermVector.NO));
|
||||
doc.add(new StringField("dataResourceId", id, Store.YES));
|
||||
|
||||
String mimeTypeId = dataResource.getString("mimeTypeId");
|
||||
if (UtilValidate.isEmpty(mimeTypeId)) {
|
||||
@@ -84,7 +83,7 @@ public class DataResourceDocument {
|
||||
String text = outWriter.toString();
|
||||
Debug.logInfo("in DataResourceDocument, text:" + text, module);
|
||||
if (UtilValidate.isNotEmpty(text))
|
||||
doc.add(new Field("content", text, Store.NO, Index.ANALYZED, TermVector.NO));
|
||||
doc.add(new TextField("content", text, Store.NO));
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class SearchWorker {
|
||||
|
||||
public static final String module = SearchWorker.class.getName();
|
||||
|
||||
public static final Version LUCENE_VERSION = Version.LUCENE_36;
|
||||
public static final Version LUCENE_VERSION = Version.LUCENE_40;
|
||||
|
||||
public static Map<String, Object> indexTree(LocalDispatcher dispatcher, Delegator delegator, String siteId, Map<String, Object> context, String path) throws Exception {
|
||||
Map<String, Object> results = FastMap.newInstance();
|
||||
@@ -161,7 +161,7 @@ public class SearchWorker {
|
||||
}
|
||||
|
||||
private static void deleteDocumentsByTerm(Term term, IndexWriter writer) throws Exception {
|
||||
IndexReader reader = IndexReader.open(writer, false);
|
||||
DirectoryReader reader = DirectoryReader.open(writer, false);
|
||||
int qtyBefore = reader.docFreq(term);
|
||||
|
||||
//deletes documents, all the rest is for logging
|
||||
|
||||
@@ -27,8 +27,8 @@ import javolution.util.FastMap;
|
||||
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.queryParser.QueryParser;
|
||||
import org.apache.lucene.index.DirectoryReader;
|
||||
import org.apache.lucene.queryparser.classic.QueryParser;
|
||||
import org.apache.lucene.search.BooleanClause;
|
||||
import org.apache.lucene.search.BooleanQuery;
|
||||
import org.apache.lucene.search.IndexSearcher;
|
||||
@@ -73,9 +73,9 @@ public class LuceneTests extends OFBizTestCase {
|
||||
|
||||
public void testSearchTermHand() throws Exception {
|
||||
Directory directory = FSDirectory.open(new File(SearchWorker.getIndexPath(null)));
|
||||
IndexReader r = null;
|
||||
DirectoryReader r = null;
|
||||
try {
|
||||
r = IndexReader.open(directory);
|
||||
r = DirectoryReader.open(directory);
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
@@ -17,12 +17,10 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.lucene.analysis.Analyzer
|
||||
import org.apache.lucene.analysis.standard.StandardAnalyzer
|
||||
import org.apache.lucene.document.Document
|
||||
import org.apache.lucene.index.IndexReader
|
||||
import org.apache.lucene.index.Term
|
||||
import org.apache.lucene.queryParser.QueryParser
|
||||
import org.apache.lucene.queryparser.classic.QueryParser
|
||||
import org.apache.lucene.store.FSDirectory
|
||||
import org.ofbiz.base.util.Debug
|
||||
import org.ofbiz.base.util.UtilHttp
|
||||
@@ -30,6 +28,7 @@ import org.ofbiz.content.search.SearchWorker
|
||||
import org.ofbiz.product.feature.ParametricSearch
|
||||
import org.apache.lucene.search.*
|
||||
import org.apache.lucene.store.Directory
|
||||
import org.apache.lucene.index.DirectoryReader
|
||||
|
||||
paramMap = UtilHttp.getParameterMap(request);
|
||||
queryLine = paramMap.queryLine.toString();
|
||||
@@ -47,9 +46,7 @@ Debug.logInfo("in search, featureIdByType:" + featureIdByType, "");
|
||||
|
||||
combQuery = new BooleanQuery();
|
||||
Directory directory = FSDirectory.open(new File(SearchWorker.getIndexPath(null)));
|
||||
IndexReader reader = IndexReader.open(directory, true); // only searching, so read-only=true
|
||||
Searcher searcher = null;
|
||||
Analyzer analyzer = null;
|
||||
DirectoryReader reader = DirectoryReader.open(directory);
|
||||
|
||||
try {
|
||||
Debug.logInfo("in search, indexPath:" + directory.toString(), "");
|
||||
|
||||
@@ -20,9 +20,8 @@
|
||||
import org.apache.lucene.analysis.Analyzer
|
||||
import org.apache.lucene.analysis.standard.StandardAnalyzer
|
||||
import org.apache.lucene.document.Document
|
||||
import org.apache.lucene.index.IndexReader
|
||||
import org.apache.lucene.index.Term
|
||||
import org.apache.lucene.queryParser.QueryParser
|
||||
import org.apache.lucene.queryparser.classic.QueryParser
|
||||
import org.apache.lucene.store.FSDirectory
|
||||
import org.ofbiz.base.util.Debug
|
||||
import org.ofbiz.base.util.UtilHttp
|
||||
@@ -30,6 +29,8 @@ import org.ofbiz.content.search.SearchWorker
|
||||
import org.ofbiz.product.feature.ParametricSearch
|
||||
import org.ofbiz.widget.html.HtmlFormWrapper
|
||||
import org.apache.lucene.search.*
|
||||
import org.apache.lucene.index.DirectoryReader
|
||||
import org.apache.lucene.store.Directory
|
||||
|
||||
paramMap = UtilHttp.getParameterMap(request);
|
||||
queryLine = paramMap.queryLine.toString();
|
||||
@@ -51,9 +52,11 @@ featureIdByType = ParametricSearch.makeFeatureIdByTypeMap(paramMap);
|
||||
//Debug.logInfo("in search, featureIdByType:" + featureIdByType, "");
|
||||
|
||||
combQuery = new BooleanQuery();
|
||||
IndexReader reader = IndexReader.open(FSDirectory.open(new File(SearchWorker.getIndexPath(null))), true); // only searching, so read-only=true
|
||||
Searcher searcher = null;
|
||||
Directory directory = FSDirectory.open(new File(SearchWorker.getIndexPath(null)));
|
||||
DirectoryReader reader = DirectoryReader.open(directory);
|
||||
IndexSearcher searcher = null;
|
||||
Analyzer analyzer = null;
|
||||
|
||||
try {
|
||||
searcher = new IndexSearcher(reader);
|
||||
analyzer = new StandardAnalyzer(SearchWorker.LUCENE_VERSION);
|
||||
|
||||
Reference in New Issue
Block a user