[DS-980] Upgraded solr & lucene to version 3.3.0

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@6545 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Tim Donohue
2011-08-12 19:49:34 +00:00
parent cda73317df
commit e40a2c9441
9 changed files with 1016 additions and 1028 deletions

View File

@@ -16,6 +16,7 @@ import org.apache.lucene.analysis.PorterStemFilter;
import org.apache.lucene.analysis.StopFilter; import org.apache.lucene.analysis.StopFilter;
import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.standard.StandardFilter; import org.apache.lucene.analysis.standard.StandardFilter;
import org.apache.lucene.util.Version;
import org.dspace.core.ConfigurationManager; import org.dspace.core.ConfigurationManager;
/** /**
@@ -47,7 +48,7 @@ public class DSAnalyzer extends Analyzer
/* /*
* Stop table * Stop table
*/ */
protected static final Set stopSet = StopFilter.makeStopSet(STOP_WORDS); protected static final Set stopSet = StopFilter.makeStopSet(Version.LUCENE_33,STOP_WORDS);
/* /*
* Create a token stream for this analyzer. * Create a token stream for this analyzer.
@@ -59,7 +60,7 @@ public class DSAnalyzer extends Analyzer
result = new StandardFilter(result); result = new StandardFilter(result);
result = new LowerCaseFilter(result); result = new LowerCaseFilter(result);
result = new StopFilter(result, stopSet); result = new StopFilter(Version.LUCENE_33, result, stopSet);
result = new PorterStemFilter(result); result = new PorterStemFilter(result);
return result; return result;

View File

@@ -39,8 +39,12 @@ import org.apache.lucene.document.Field;
import org.apache.lucene.document.DateTools; import org.apache.lucene.document.DateTools;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermDocs; import org.apache.lucene.index.TermDocs;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.util.Version;
import org.dspace.content.Bitstream; import org.dspace.content.Bitstream;
import org.dspace.content.Bundle; import org.dspace.content.Bundle;
import org.dspace.content.Collection; import org.dspace.content.Collection;
@@ -208,21 +212,22 @@ public class DSIndexer
/* /*
* Create the index directory if it doesn't already exist. * Create the index directory if it doesn't already exist.
*/ */
if (!IndexReader.indexExists(indexDirectory)) try
{ {
try if (!IndexReader.indexExists(FSDirectory.open(new File(indexDirectory))))
{ {
if (!new File(indexDirectory).mkdirs())
if (!new File(indexDirectory).mkdirs())
{ {
log.error("Unable to create index directory: " + indexDirectory); log.error("Unable to create index directory: " + indexDirectory);
} }
openIndex(true).close(); openIndex(true).close();
}
catch (IOException e)
{
throw new IllegalStateException("Could not create search index: " + e.getMessage(),e);
} }
} }
catch (IOException e)
{
throw new IllegalStateException("Could not create search index: " + e.getMessage(),e);
}
} }
public static void setBatchProcessingMode(boolean mode) public static void setBatchProcessingMode(boolean mode)
@@ -902,8 +907,15 @@ public class DSIndexer
private static IndexWriter openIndex(boolean wipeExisting) private static IndexWriter openIndex(boolean wipeExisting)
throws IOException throws IOException
{ {
Directory dir = FSDirectory.open(new File(indexDirectory));
IndexWriter writer = new IndexWriter(indexDirectory, getAnalyzer(), wipeExisting); IndexWriterConfig iwc = new IndexWriterConfig(Version.LUCENE_33, getAnalyzer());
if(wipeExisting){
iwc.setOpenMode(IndexWriterConfig.OpenMode.CREATE);
}else{
iwc.setOpenMode(IndexWriterConfig.OpenMode.CREATE_OR_APPEND);
}
IndexWriter writer = new IndexWriter(dir, iwc);
/* Set maximum number of terms to index if present in dspace.cfg */ /* Set maximum number of terms to index if present in dspace.cfg */
if (maxfieldlength == -1) if (maxfieldlength == -1)
@@ -982,8 +994,8 @@ public class DSIndexer
if (name != null) if (name != null)
{ {
doc.add(new Field("name", name, Field.Store.NO, Field.Index.TOKENIZED)); doc.add(new Field("name", name, Field.Store.NO, Field.Index.ANALYZED));
doc.add(new Field("default", name, Field.Store.NO, Field.Index.TOKENIZED)); doc.add(new Field("default", name, Field.Store.NO, Field.Index.ANALYZED));
} }
return doc; return doc;
@@ -1008,8 +1020,8 @@ public class DSIndexer
if (name != null) if (name != null)
{ {
doc.add(new Field("name", name, Field.Store.NO, Field.Index.TOKENIZED)); doc.add(new Field("name", name, Field.Store.NO, Field.Index.ANALYZED));
doc.add(new Field("default", name, Field.Store.NO, Field.Index.TOKENIZED)); doc.add(new Field("default", name, Field.Store.NO, Field.Index.ANALYZED));
} }
return doc; return doc;
@@ -1062,12 +1074,12 @@ public class DSIndexer
doc.add( new Field(indexConfigArr[i].indexName, doc.add( new Field(indexConfigArr[i].indexName,
DateTools.dateToString(d, DateTools.Resolution.SECOND), DateTools.dateToString(d, DateTools.Resolution.SECOND),
Field.Store.NO, Field.Store.NO,
Field.Index.UN_TOKENIZED)); Field.Index.NOT_ANALYZED));
doc.add( new Field(indexConfigArr[i].indexName + ".year", doc.add( new Field(indexConfigArr[i].indexName + ".year",
DateTools.dateToString(d, DateTools.Resolution.YEAR), DateTools.dateToString(d, DateTools.Resolution.YEAR),
Field.Store.NO, Field.Store.NO,
Field.Index.UN_TOKENIZED)); Field.Index.NOT_ANALYZED));
} }
} }
else if ("date".equalsIgnoreCase(indexConfigArr[i].type)) else if ("date".equalsIgnoreCase(indexConfigArr[i].type))
@@ -1078,12 +1090,12 @@ public class DSIndexer
doc.add( new Field(indexConfigArr[i].indexName, doc.add( new Field(indexConfigArr[i].indexName,
DateTools.dateToString(d, DateTools.Resolution.DAY), DateTools.dateToString(d, DateTools.Resolution.DAY),
Field.Store.NO, Field.Store.NO,
Field.Index.UN_TOKENIZED)); Field.Index.NOT_ANALYZED));
doc.add( new Field(indexConfigArr[i].indexName + ".year", doc.add( new Field(indexConfigArr[i].indexName + ".year",
DateTools.dateToString(d, DateTools.Resolution.YEAR), DateTools.dateToString(d, DateTools.Resolution.YEAR),
Field.Store.NO, Field.Store.NO,
Field.Index.UN_TOKENIZED)); Field.Index.NOT_ANALYZED));
} }
} }
else else
@@ -1099,7 +1111,7 @@ public class DSIndexer
doc.add( new Field(indexConfigArr[i].indexName+"_authority", doc.add( new Field(indexConfigArr[i].indexName+"_authority",
mydc[j].authority, mydc[j].authority,
Field.Store.NO, Field.Store.NO,
Field.Index.UN_TOKENIZED)); Field.Index.NOT_ANALYZED));
boolean valueAlreadyIndexed = false; boolean valueAlreadyIndexed = false;
if (variants != null) if (variants != null)
@@ -1110,7 +1122,7 @@ public class DSIndexer
doc.add( new Field(indexConfigArr[i].indexName, doc.add( new Field(indexConfigArr[i].indexName,
var, var,
Field.Store.NO, Field.Store.NO,
Field.Index.TOKENIZED)); Field.Index.ANALYZED));
if (var.equals(mydc[j].value)) if (var.equals(mydc[j].value))
{ {
valueAlreadyIndexed = true; valueAlreadyIndexed = true;
@@ -1121,7 +1133,7 @@ public class DSIndexer
doc.add( new Field("default", doc.add( new Field("default",
var, var,
Field.Store.NO, Field.Store.NO,
Field.Index.TOKENIZED)); Field.Index.ANALYZED));
} }
} }
} }
@@ -1132,7 +1144,7 @@ public class DSIndexer
doc.add( new Field(indexConfigArr[i].indexName, doc.add( new Field(indexConfigArr[i].indexName,
mydc[j].value, mydc[j].value,
Field.Store.NO, Field.Store.NO,
Field.Index.TOKENIZED)); Field.Index.ANALYZED));
} }
} }
else else
@@ -1141,11 +1153,11 @@ public class DSIndexer
doc.add( new Field(indexConfigArr[i].indexName, doc.add( new Field(indexConfigArr[i].indexName,
mydc[j].value, mydc[j].value,
Field.Store.NO, Field.Store.NO,
Field.Index.TOKENIZED)); Field.Index.ANALYZED));
} }
} }
doc.add( new Field("default", mydc[j].value, Field.Store.NO, Field.Index.TOKENIZED)); doc.add( new Field("default", mydc[j].value, Field.Store.NO, Field.Index.ANALYZED));
} }
} }
} }
@@ -1164,7 +1176,7 @@ public class DSIndexer
if (dcv.length > 0) if (dcv.length > 0)
{ {
String value = OrderFormat.makeSortString(dcv[0].value, dcv[0].language, so.getType()); String value = OrderFormat.makeSortString(dcv[0].value, dcv[0].language, so.getType());
doc.add( new Field("sort_" + so.getName(), value, Field.Store.NO, Field.Index.UN_TOKENIZED) ); doc.add( new Field("sort_" + so.getName(), value, Field.Store.NO, Field.Index.NOT_ANALYZED) );
} }
} }
} }
@@ -1230,15 +1242,15 @@ public class DSIndexer
// want to be able to check when last updated // want to be able to check when last updated
// (not tokenized, but it is indexed) // (not tokenized, but it is indexed)
doc.add(new Field(LAST_INDEXED_FIELD, Long.toString(System.currentTimeMillis()), Field.Store.YES, Field.Index.UN_TOKENIZED)); doc.add(new Field(LAST_INDEXED_FIELD, Long.toString(System.currentTimeMillis()), Field.Store.YES, Field.Index.NOT_ANALYZED));
doc.add(new Field(DOCUMENT_STATUS_FIELD, "archived", Field.Store.YES, Field.Index.UN_TOKENIZED)); doc.add(new Field(DOCUMENT_STATUS_FIELD, "archived", Field.Store.YES, Field.Index.NOT_ANALYZED));
// KEPT FOR BACKWARDS COMPATIBILITY // KEPT FOR BACKWARDS COMPATIBILITY
// do location, type, handle first // do location, type, handle first
doc.add(new Field("type", Integer.toString(type), Field.Store.YES, Field.Index.NO)); doc.add(new Field("type", Integer.toString(type), Field.Store.YES, Field.Index.NO));
// New fields to weaken the dependence on handles, and allow for faster list display // New fields to weaken the dependence on handles, and allow for faster list display
doc.add(new Field("search.resourcetype", Integer.toString(type), Field.Store.YES, Field.Index.UN_TOKENIZED)); doc.add(new Field("search.resourcetype", Integer.toString(type), Field.Store.YES, Field.Index.NOT_ANALYZED));
doc.add(new Field("search.resourceid", Integer.toString(id), Field.Store.YES, Field.Index.NO)); doc.add(new Field("search.resourceid", Integer.toString(id), Field.Store.YES, Field.Index.NO));
// want to be able to search for handle, so use keyword // want to be able to search for handle, so use keyword
@@ -1246,20 +1258,20 @@ public class DSIndexer
if (handle != null) if (handle != null)
{ {
// ??? not sure what the "handletext" field is but it was there in writeItemIndex ??? // ??? not sure what the "handletext" field is but it was there in writeItemIndex ???
doc.add(new Field("handletext", handle, Field.Store.YES, Field.Index.TOKENIZED)); doc.add(new Field("handletext", handle, Field.Store.YES, Field.Index.ANALYZED));
// want to be able to search for handle, so use keyword // want to be able to search for handle, so use keyword
// (not tokenized, but it is indexed) // (not tokenized, but it is indexed)
doc.add(new Field("handle", handle, Field.Store.YES, Field.Index.UN_TOKENIZED)); doc.add(new Field("handle", handle, Field.Store.YES, Field.Index.NOT_ANALYZED));
// add to full text index // add to full text index
doc.add(new Field("default", handle, Field.Store.NO, Field.Index.TOKENIZED)); doc.add(new Field("default", handle, Field.Store.NO, Field.Index.ANALYZED));
} }
if(location != null) if(location != null)
{ {
doc.add(new Field("location", location, Field.Store.NO, Field.Index.TOKENIZED)); doc.add(new Field("location", location, Field.Store.NO, Field.Index.ANALYZED));
doc.add(new Field("default", location, Field.Store.NO, Field.Index.TOKENIZED)); doc.add(new Field("default", location, Field.Store.NO, Field.Index.ANALYZED));
} }
return doc; return doc;
@@ -1271,8 +1283,8 @@ public class DSIndexer
// want to be able to check when last updated // want to be able to check when last updated
// (not tokenized, but it is indexed) // (not tokenized, but it is indexed)
doc.add(new Field(LAST_INDEXED_FIELD, Long.toString(System.currentTimeMillis()), Field.Store.YES, Field.Index.UN_TOKENIZED)); doc.add(new Field(LAST_INDEXED_FIELD, Long.toString(System.currentTimeMillis()), Field.Store.YES, Field.Index.NOT_ANALYZED));
doc.add(new Field(DOCUMENT_STATUS_FIELD, "deleted", Field.Store.YES, Field.Index.UN_TOKENIZED)); doc.add(new Field(DOCUMENT_STATUS_FIELD, "deleted", Field.Store.YES, Field.Index.NOT_ANALYZED));
// Do not add any other fields, as we don't want to be able to find it - just check the last indexed time // Do not add any other fields, as we don't want to be able to find it - just check the last indexed time
@@ -1285,8 +1297,8 @@ public class DSIndexer
// want to be able to check when last updated // want to be able to check when last updated
// (not tokenized, but it is indexed) // (not tokenized, but it is indexed)
doc.add(new Field(LAST_INDEXED_FIELD, Long.toString(System.currentTimeMillis()), Field.Store.YES, Field.Index.UN_TOKENIZED)); doc.add(new Field(LAST_INDEXED_FIELD, Long.toString(System.currentTimeMillis()), Field.Store.YES, Field.Index.NOT_ANALYZED));
doc.add(new Field(DOCUMENT_STATUS_FIELD, "withdrawn", Field.Store.YES, Field.Index.UN_TOKENIZED)); doc.add(new Field(DOCUMENT_STATUS_FIELD, "withdrawn", Field.Store.YES, Field.Index.NOT_ANALYZED));
// Do not add any other fields, as we don't want to be able to find it - just check the last indexed time // Do not add any other fields, as we don't want to be able to find it - just check the last indexed time

View File

@@ -13,6 +13,7 @@ import org.apache.lucene.analysis.LowerCaseFilter;
import org.apache.lucene.analysis.StopFilter; import org.apache.lucene.analysis.StopFilter;
import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.standard.StandardFilter; import org.apache.lucene.analysis.standard.StandardFilter;
import org.apache.lucene.util.Version;
/** /**
* Custom Lucene Analyzer that combines the standard filter, lowercase filter * Custom Lucene Analyzer that combines the standard filter, lowercase filter
@@ -32,7 +33,7 @@ public class DSNonStemmingAnalyzer extends DSAnalyzer
result = new StandardFilter(result); result = new StandardFilter(result);
result = new LowerCaseFilter(result); result = new LowerCaseFilter(result);
result = new StopFilter(result, stopSet); result = new StopFilter(Version.LUCENE_33, result, stopSet);
return result; return result;
} }

View File

@@ -7,6 +7,7 @@
*/ */
package org.dspace.search; package org.dspace.search;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
@@ -19,12 +20,14 @@ import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.queryParser.QueryParser; import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.queryParser.TokenMgrError; import org.apache.lucene.queryParser.TokenMgrError;
import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.Hits;
import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query; import org.apache.lucene.search.Query;
import org.apache.lucene.search.Searcher;
import org.apache.lucene.search.Sort; import org.apache.lucene.search.Sort;
import org.apache.lucene.search.SortField; import org.apache.lucene.search.SortField;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.util.Version;
import org.dspace.content.Collection; import org.dspace.content.Collection;
import org.dspace.content.Community; import org.dspace.content.Community;
import org.dspace.core.ConfigurationManager; import org.dspace.core.ConfigurationManager;
@@ -113,9 +116,9 @@ public class DSQuery
try try
{ {
// grab a searcher, and do the search // grab a searcher, and do the search
Searcher searcher = getSearcher(c); IndexSearcher searcher = getSearcher(c);
QueryParser qp = new QueryParser("default", DSIndexer.getAnalyzer()); QueryParser qp = new QueryParser(Version.LUCENE_33, "default", DSIndexer.getAnalyzer());
log.debug("Final query string: " + querystring); log.debug("Final query string: " + querystring);
if (operator == null || operator.equals("OR")) if (operator == null || operator.equals("OR"))
@@ -126,57 +129,30 @@ public class DSQuery
{ {
qp.setDefaultOperator(QueryParser.AND_OPERATOR); qp.setDefaultOperator(QueryParser.AND_OPERATOR);
} }
Query myquery = qp.parse(querystring);
Hits hits = null;
try Query myquery = qp.parse(querystring);
{ //Retrieve enough docs to get all the results we need !
if (args.getSortOption() == null) TopDocs hits = performQuery(args, searcher, myquery, args.getPageSize() * (args.getStart() + 1));
{
SortField[] sortFields = new SortField[] {
new SortField("search.resourcetype", true),
new SortField(null, SortField.SCORE, SortOption.ASCENDING.equals(args.getSortOrder()))
};
hits = searcher.search(myquery, new Sort(sortFields));
}
else
{
SortField[] sortFields = new SortField[] {
new SortField("search.resourcetype", true),
new SortField("sort_" + args.getSortOption().getName(), SortOption.DESCENDING.equals(args.getSortOrder())),
SortField.FIELD_SCORE
};
hits = searcher.search(myquery, new Sort(sortFields));
}
}
catch (Exception e)
{
// Lucene can throw an exception if it is unable to determine a sort time from the specified field
// Provide a fall back that just works on relevancy.
log.error("Unable to use speficied sort option: " + (args.getSortOption() == null ? "type/relevance": args.getSortOption().getName()));
hits = searcher.search(myquery, new Sort(SortField.FIELD_SCORE));
}
// set total number of hits // set total number of hits
qr.setHitCount(hits.length()); qr.setHitCount(hits.totalHits);
// We now have a bunch of hits - snip out a 'window' // We now have a bunch of hits - snip out a 'window'
// defined in start, count and return the handles // defined in start, count and return the handles
// from that window // from that window
// first, are there enough hits? // first, are there enough hits?
if (args.getStart() < hits.length()) if (args.getStart() < hits.totalHits)
{ {
// get as many as we can, up to the window size // get as many as we can, up to the window size
// how many are available after snipping off at offset 'start'? // how many are available after snipping off at offset 'start'?
int hitsRemaining = hits.length() - args.getStart(); int hitsRemaining = hits.totalHits - args.getStart();
int hitsToProcess = (hitsRemaining < args.getPageSize()) ? hitsRemaining int hitsToProcess = (hitsRemaining < args.getPageSize()) ? hitsRemaining
: args.getPageSize(); : args.getPageSize();
for (int i = args.getStart(); i < (args.getStart() + hitsToProcess); i++) for (int i = args.getStart(); i < (args.getStart() + hitsToProcess); i++)
{ {
Document d = hits.doc(i); Document d = searcher.doc(hits.scoreDocs[i].doc);
String resourceId = d.get("search.resourceid"); String resourceId = d.get("search.resourceid");
String resourceType = d.get("search.resourcetype"); String resourceType = d.get("search.resourcetype");
@@ -187,15 +163,15 @@ public class DSQuery
switch (Integer.parseInt( resourceType != null ? resourceType : handleType)) switch (Integer.parseInt( resourceType != null ? resourceType : handleType))
{ {
case Constants.ITEM: case Constants.ITEM:
hitTypes.add(Integer.valueOf(Constants.ITEM)); hitTypes.add(Constants.ITEM);
break; break;
case Constants.COLLECTION: case Constants.COLLECTION:
hitTypes.add(Integer.valueOf(Constants.COLLECTION)); hitTypes.add(Constants.COLLECTION);
break; break;
case Constants.COMMUNITY: case Constants.COMMUNITY:
hitTypes.add(Integer.valueOf(Constants.COMMUNITY)); hitTypes.add(Constants.COMMUNITY);
break; break;
} }
@@ -230,6 +206,38 @@ public class DSQuery
return qr; return qr;
} }
private static TopDocs performQuery(QueryArgs args, IndexSearcher searcher, Query myquery, int max) throws IOException {
TopDocs hits;
try
{
if (args.getSortOption() == null)
{
SortField[] sortFields = new SortField[] {
new SortField("search.resourcetype", SortField.INT, true),
new SortField(null, SortField.SCORE, SortOption.ASCENDING.equals(args.getSortOrder()))
};
hits = searcher.search(myquery, max, new Sort(sortFields));
}
else
{
SortField[] sortFields = new SortField[] {
new SortField("search.resourcetype", SortField.INT, true),
new SortField("sort_" + args.getSortOption().getName(), SortField.STRING, SortOption.DESCENDING.equals(args.getSortOrder())),
SortField.FIELD_SCORE
};
hits = searcher.search(myquery, max, new Sort(sortFields));
}
}
catch (Exception e)
{
// Lucene can throw an exception if it is unable to determine a sort time from the specified field
// Provide a fall back that just works on relevancy.
log.error("Unable to use speficied sort option: " + (args.getSortOption() == null ? "type/relevance": args.getSortOption().getName()));
hits = searcher.search(myquery, max, new Sort(SortField.FIELD_SCORE));
}
return hits;
}
static String checkEmptyQuery(String myquery) static String checkEmptyQuery(String myquery)
{ {
if (myquery == null || myquery.equals("()") || myquery.equals("")) if (myquery == null || myquery.equals("()") || myquery.equals(""))
@@ -359,7 +367,7 @@ public class DSQuery
{ {
String thisHandle = (String) i.next(); String thisHandle = (String) i.next();
Integer thisType = (Integer) j.next(); Integer thisType = (Integer) j.next();
String type = Constants.typeText[thisType.intValue()]; String type = Constants.typeText[thisType];
// also look up type // also look up type
System.out.println(type + "\t" + thisHandle); System.out.println(type + "\t" + thisHandle);
@@ -421,7 +429,10 @@ public class DSQuery
// If we have already opened a searcher, check to see if the index has been updated // If we have already opened a searcher, check to see if the index has been updated
// If it has, we need to close the existing searcher - we will open a new one later // If it has, we need to close the existing searcher - we will open a new one later
if (searcher != null && lastModified != IndexReader.getCurrentVersion(indexDir))
Directory searchDir = FSDirectory.open(new File(indexDir));
if (searcher != null && lastModified != IndexReader.getCurrentVersion(searchDir))
{ {
try try
{ {
@@ -445,17 +456,18 @@ public class DSQuery
if (searcher == null) if (searcher == null)
{ {
// So, open a new searcher // So, open a new searcher
lastModified = IndexReader.getCurrentVersion(indexDir); lastModified = IndexReader.getCurrentVersion(searchDir);
String osName = System.getProperty("os.name"); String osName = System.getProperty("os.name");
if (osName != null && osName.toLowerCase().contains("windows")) if (osName != null && osName.toLowerCase().contains("windows"))
{ {
searcher = new IndexSearcher(indexDir){ searcher = new IndexSearcher(searchDir){
/* /*
* TODO: Has Lucene fixed this bug yet? * TODO: Has Lucene fixed this bug yet?
* Lucene doesn't release read locks in * Lucene doesn't release read locks in
* windows properly on finalize. Our hack * windows properly on finalize. Our hack
* extend IndexSearcher to force close(). * extend IndexSearcher to force close().
*/ */
@Override
protected void finalize() throws Throwable { protected void finalize() throws Throwable {
this.close(); this.close();
super.finalize(); super.finalize();
@@ -464,7 +476,7 @@ public class DSQuery
} }
else else
{ {
searcher = new IndexSearcher(indexDir); searcher = new IndexSearcher(searchDir);
} }
} }

View File

@@ -1,60 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging> <packaging>jar</packaging>
<groupId>org.dspace</groupId> <groupId>org.dspace</groupId>
<artifactId>dspace-discovery-solr</artifactId> <artifactId>dspace-discovery-solr</artifactId>
<version>1.8.0-SNAPSHOT</version> <version>1.8.0-SNAPSHOT</version>
<name>DSpace Discovery :: Discovery Solr Implementation</name> <name>DSpace Discovery :: Discovery Solr Implementation</name>
<parent> <parent>
<groupId>org.dspace</groupId> <groupId>org.dspace</groupId>
<artifactId>discovery-modules</artifactId> <artifactId>discovery-modules</artifactId>
<version>1.8.0-SNAPSHOT</version> <version>1.8.0-SNAPSHOT</version>
</parent> </parent>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.dspace</groupId> <groupId>org.dspace</groupId>
<artifactId>dspace-discovery-provider</artifactId> <artifactId>dspace-discovery-provider</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId> <artifactId>servlet-api</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.solr</groupId> <groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId> <artifactId>solr-solrj</artifactId>
<version>1.4.1</version> <version>3.3.0</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<!-- <!--
The Subversion repository location is used by Continuum to update The Subversion repository location is used by Continuum to update
against when changes have occured, this spawns a new build cycle against when changes have occured, this spawns a new build cycle
and releases snapshots into the snapshot repository below. and releases snapshots into the snapshot repository below.
--> -->
<scm> <scm>
<connection>scm:svn:http://scm.dspace.org/svn/repo/dspace/trunk/dspace-discovery/dspace-discovery-solr</connection> <connection>scm:svn:http://scm.dspace.org/svn/repo/dspace/trunk/dspace-discovery/dspace-discovery-solr</connection>
<developerConnection> <developerConnection>
scm:svn:https://scm.dspace.org/svn/repo/dspace/trunk/dspace-discovery/dspace-discovery-solr scm:svn:https://scm.dspace.org/svn/repo/dspace/trunk/dspace-discovery/dspace-discovery-solr
</developerConnection> </developerConnection>
<url>http://scm.dspace.org/svn/repo/dspace/trunk/dspace-discovery/dspace-discovery-solr</url> <url>http://scm.dspace.org/svn/repo/dspace/trunk/dspace-discovery/dspace-discovery-solr</url>
</scm> </scm>
</project> </project>

View File

@@ -1,135 +1,135 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent> <parent>
<artifactId>dspace-parent</artifactId> <artifactId>dspace-parent</artifactId>
<groupId>org.dspace</groupId> <groupId>org.dspace</groupId>
<version>1.8.0-SNAPSHOT</version> <version>1.8.0-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.dspace</groupId> <groupId>org.dspace</groupId>
<artifactId>dspace-stats</artifactId> <artifactId>dspace-stats</artifactId>
<name>DSpace Solr Statistics Logging Client Library</name> <name>DSpace Solr Statistics Logging Client Library</name>
<version>1.8.0-SNAPSHOT</version> <version>1.8.0-SNAPSHOT</version>
<description>Library of Shared UsageEvent and EventConsumer Tools for Logging to Solr.</description> <description>Library of Shared UsageEvent and EventConsumer Tools for Logging to Solr.</description>
<!-- <!--
The Subversion repository location is used by Continuum to update The Subversion repository location is used by Continuum to update
against when changes have occured, this spawns a new build cycle and against when changes have occured, this spawns a new build cycle and
releases snapshots into the snapshot repository below. releases snapshots into the snapshot repository below.
--> -->
<scm> <scm>
<connection>scm:svn:http://scm.dspace.org/svn/repo/dspace/trunk/dspace-stats</connection> <connection>scm:svn:http://scm.dspace.org/svn/repo/dspace/trunk/dspace-stats</connection>
<developerConnection>scm:svn:https://scm.dspace.org/svn/repo/dspace/trunk/dspace-stats</developerConnection> <developerConnection>scm:svn:https://scm.dspace.org/svn/repo/dspace/trunk/dspace-stats</developerConnection>
<url>http://scm.dspace.org/svn/repo/dspace/trunk/dspace-stats</url> <url>http://scm.dspace.org/svn/repo/dspace/trunk/dspace-stats</url>
</scm> </scm>
<developers> <developers>
<developer> <developer>
<name>Ben Bosman</name> <name>Ben Bosman</name>
<email>ben at atmire.com</email> <email>ben at atmire.com</email>
<url>http://www.atmire.com</url> <url>http://www.atmire.com</url>
<organization>@MIRE</organization> <organization>@MIRE</organization>
<organizationUrl>http://www.atmire.com</organizationUrl> <organizationUrl>http://www.atmire.com</organizationUrl>
<timezone>+1</timezone> <timezone>+1</timezone>
</developer> </developer>
<developer> <developer>
<name>Mark Diggory</name> <name>Mark Diggory</name>
<email>mdiggory at atmire.com</email> <email>mdiggory at atmire.com</email>
<url>http://www.atmire.com</url> <url>http://www.atmire.com</url>
<organization>@MIRE</organization> <organization>@MIRE</organization>
<organizationUrl>http://www.atmire.com</organizationUrl> <organizationUrl>http://www.atmire.com</organizationUrl>
<timezone>-5</timezone> <timezone>-5</timezone>
</developer> </developer>
<developer> <developer>
<name>Lieven Droogmans</name> <name>Lieven Droogmans</name>
<email>lieven at atmire.com</email> <email>lieven at atmire.com</email>
<url>http://www.atmire.com</url> <url>http://www.atmire.com</url>
<organization>@MIRE</organization> <organization>@MIRE</organization>
<organizationUrl>http://www.atmire.com</organizationUrl> <organizationUrl>http://www.atmire.com</organizationUrl>
<timezone>+1</timezone> <timezone>+1</timezone>
</developer> </developer>
<developer> <developer>
<name>Art Lowel</name> <name>Art Lowel</name>
<email>art at atmire.com</email> <email>art at atmire.com</email>
<url>http://www.atmire.com</url> <url>http://www.atmire.com</url>
<organization>@MIRE</organization> <organization>@MIRE</organization>
<organizationUrl>http://www.atmire.com</organizationUrl> <organizationUrl>http://www.atmire.com</organizationUrl>
<timezone>+1</timezone> <timezone>+1</timezone>
</developer> </developer>
<developer> <developer>
<name>Kevin Van de velde</name> <name>Kevin Van de velde</name>
<email>kevin at atmire.com</email> <email>kevin at atmire.com</email>
<url>http://www.atmire.com</url> <url>http://www.atmire.com</url>
<organization>@MIRE</organization> <organization>@MIRE</organization>
<organizationUrl>http://www.atmire.com</organizationUrl> <organizationUrl>http://www.atmire.com</organizationUrl>
<timezone>+1</timezone> <timezone>+1</timezone>
</developer> </developer>
</developers> </developers>
<contributors /> <contributors />
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.dspace</groupId> <groupId>org.dspace</groupId>
<artifactId>dspace-services-api</artifactId> <artifactId>dspace-services-api</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.dspace</groupId> <groupId>org.dspace</groupId>
<artifactId>dspace-api</artifactId> <artifactId>dspace-api</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.solr</groupId> <groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId> <artifactId>solr-solrj</artifactId>
<version>1.4.1</version> <version>3.3.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.dspace.dependencies</groupId> <groupId>org.dspace.dependencies</groupId>
<artifactId>dspace-geoip</artifactId> <artifactId>dspace-geoip</artifactId>
<version>1.2.3</version> <version>1.2.3</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.ant</groupId> <groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId> <artifactId>ant</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.dspace.dnsjava</groupId> <groupId>org.dspace.dnsjava</groupId>
<artifactId>dnsjava</artifactId> <artifactId>dnsjava</artifactId>
<version>2.0.6</version> <version>2.0.6</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId> <artifactId>servlet-api</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.ostermiller</groupId> <groupId>org.ostermiller</groupId>
<artifactId>utils</artifactId> <artifactId>utils</artifactId>
<version>1.07.00</version> <version>1.07.00</version>
</dependency> </dependency>
</dependencies> </dependencies>
<reporting> <reporting>
<excludeDefaults>false</excludeDefaults> <excludeDefaults>false</excludeDefaults>
<plugins> <plugins>
<plugin> <plugin>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<configuration> <configuration>
<minmemory>128m</minmemory> <minmemory>128m</minmemory>
<maxmemory>1g</maxmemory> <maxmemory>1g</maxmemory>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<artifactId>maven-jxr-plugin</artifactId> <artifactId>maven-jxr-plugin</artifactId>
<configuration> <configuration>
<aggregate>true</aggregate> <aggregate>true</aggregate>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<artifactId>maven-site-plugin</artifactId> <artifactId>maven-site-plugin</artifactId>
</plugin> </plugin>
</plugins> </plugins>
</reporting> </reporting>
</project> </project>

View File

@@ -1,84 +1,84 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.dspace.modules</groupId> <groupId>org.dspace.modules</groupId>
<artifactId>solr</artifactId> <artifactId>solr</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<name>DSpace SOLR :: Web Application</name> <name>DSpace SOLR :: Web Application</name>
<description> <description>
DSpace SOLR Service Provider Web Application DSpace SOLR Service Provider Web Application
</description> </description>
<!-- <!--
A Parent POM that Maven inherits DSpace Default A Parent POM that Maven inherits DSpace Default
POM atrributes from. POM atrributes from.
--> -->
<parent> <parent>
<groupId>org.dspace</groupId> <groupId>org.dspace</groupId>
<artifactId>modules</artifactId> <artifactId>modules</artifactId>
<version>1.8.0-SNAPSHOT</version> <version>1.8.0-SNAPSHOT</version>
</parent> </parent>
<!-- <!--
The Subversion repository location is used by Continuum to update The Subversion repository location is used by Continuum to update
against when changes have occured, this spawns a new build cycle against when changes have occured, this spawns a new build cycle
and releases snapshots into the snapshot repository below. and releases snapshots into the snapshot repository below.
--> -->
<scm> <scm>
<connection>scm:svn:http://dspace.svn.sourceforge.net/svnroot/dspace/trunk/dspace/modules/solr</connection> <connection>scm:svn:http://dspace.svn.sourceforge.net/svnroot/dspace/trunk/dspace/modules/solr</connection>
<developerConnection>scm:svn:https://dspace.svn.sourceforge.net/svnroot/dspace/trunk/dspace/modules/solr</developerConnection> <developerConnection>scm:svn:https://dspace.svn.sourceforge.net/svnroot/dspace/trunk/dspace/modules/solr</developerConnection>
<url>http://dspace.svn.sourceforge.net/svnroot/dspace/trunk/dspace/modules/solr</url> <url>http://dspace.svn.sourceforge.net/svnroot/dspace/trunk/dspace/modules/solr</url>
</scm> </scm>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId> <artifactId>maven-war-plugin</artifactId>
<executions> <executions>
<execution> <execution>
<phase>prepare-package</phase> <phase>prepare-package</phase>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.dspace</groupId> <groupId>org.dspace</groupId>
<artifactId>dspace-solr</artifactId> <artifactId>dspace-solr</artifactId>
<version>1.4.1.0</version> <version>3.3.0.0</version>
<classifier>skinny</classifier> <classifier>skinny</classifier>
<type>war</type> <type>war</type>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.dspace</groupId> <groupId>org.dspace</groupId>
<artifactId>dspace-solr</artifactId> <artifactId>dspace-solr</artifactId>
<version>1.4.1.0</version> <version>3.3.0.0</version>
<classifier>classes</classifier> <classifier>classes</classifier>
<type>jar</type> <type>jar</type>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
<version>1.5.6</version> <version>1.5.6</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId> <artifactId>slf4j-jdk14</artifactId>
<version>1.5.6</version> <version>1.5.6</version>
</dependency> </dependency>
<!-- support odd cases where JAXP cannot be found in JVM --> <!-- support odd cases where JAXP cannot be found in JVM -->
<dependency> <dependency>
<groupId>xalan</groupId> <groupId>xalan</groupId>
<artifactId>xalan</artifactId> <artifactId>xalan</artifactId>
<version>2.7.0</version> <version>2.7.0</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

File diff suppressed because it is too large Load Diff

View File

@@ -347,12 +347,12 @@
<dependency> <dependency>
<groupId>org.apache.lucene</groupId> <groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId> <artifactId>lucene-core</artifactId>
<version>2.9.3</version> <version>3.3.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.lucene</groupId> <groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers</artifactId> <artifactId>lucene-analyzers</artifactId>
<version>2.9.3</version> <version>3.3.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.dspace</groupId> <groupId>org.dspace</groupId>