diff --git a/webapp/config/example.deploy.properties b/webapp/config/example.deploy.properties
index b0a40eb72..abb6f1ad2 100644
--- a/webapp/config/example.deploy.properties
+++ b/webapp/config/example.deploy.properties
@@ -33,7 +33,7 @@ webapp.name = vitro
#
# The location where the Vitro application will store the data that it creates.
-# This includes uploaded files (usually images) and the Lucene search index.
+# This includes uploaded files (usually images) and the search index.
#
vitro.home.directory = /usr/local/vitro/data
diff --git a/webapp/config/web.xml b/webapp/config/web.xml
index f31538b32..e6dab1f40 100644
--- a/webapp/config/web.xml
+++ b/webapp/config/web.xml
@@ -155,12 +155,6 @@
edu.cornell.mannlib.vitro.webapp.auth.policy.RootUserPolicy$Setup
-
-
edu.cornell.mannlib.vitro.webapp.search.solr.SolrSetup
@@ -874,12 +868,6 @@
/listObjectPropertyStatements
-
IndividualListController
edu.cornell.mannlib.vitro.webapp.controller.freemarker.SolrIndividualListController
@@ -889,12 +877,6 @@
/individuallist
-
IndividualListRdf
edu.cornell.mannlib.vitro.webapp.controller.IndividualListRdfController
@@ -904,12 +886,6 @@
/listrdf/*
-
SearchController
edu.cornell.mannlib.vitro.webapp.search.controller.SolrPagedSearchController
@@ -933,12 +909,6 @@
/searchcontroller
-
AutocompleteController
edu.cornell.mannlib.vitro.webapp.search.controller.SolrAutocompleteController
@@ -988,12 +958,6 @@
/contact
-
JSON Service
edu.cornell.mannlib.vitro.webapp.controller.SolrJsonServlet
diff --git a/webapp/lib/lucene-analyzers-2.9.3.jar b/webapp/lib/lucene-analyzers-2.9.3.jar
deleted file mode 100644
index 05bb2d576..000000000
Binary files a/webapp/lib/lucene-analyzers-2.9.3.jar and /dev/null differ
diff --git a/webapp/lib/lucene-core-2.9.3.jar b/webapp/lib/lucene-core-2.9.3.jar
deleted file mode 100644
index 4351f976b..000000000
Binary files a/webapp/lib/lucene-core-2.9.3.jar and /dev/null differ
diff --git a/webapp/lib/lucene-highlighter-2.9.3.jar b/webapp/lib/lucene-highlighter-2.9.3.jar
deleted file mode 100644
index 1b9cce4ec..000000000
Binary files a/webapp/lib/lucene-highlighter-2.9.3.jar and /dev/null differ
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/SolrJsonServlet.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/SolrJsonServlet.java
index eaa7c4844..a6cadfbd3 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/SolrJsonServlet.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/SolrJsonServlet.java
@@ -271,9 +271,7 @@ public class SolrJsonServlet extends VitroHttpServlet {
return map;
}
-
- //Factoring out to allow for results to be processed from query for both lucene and solr
- //Map given to process method includes the actual individuals returned from the search
+ // Map given to process method includes the actual individuals returned from the search
public static JSONObject processVClassResults(Map map, VitroRequest vreq, ServletContext context, boolean multipleVclasses) throws Exception{
JSONObject rObj = DataGetterUtils.processVclassResultsJSON(map, vreq, multipleVclasses);
return rObj;
@@ -331,7 +329,7 @@ public class SolrJsonServlet extends VitroHttpServlet {
.getAttribute("displayOntModel");
if (displayOntModel != null) {
ProhibitedFromSearch pfs = new ProhibitedFromSearch(
- DisplayVocabulary.PRIMARY_LUCENE_INDEX_URI, displayOntModel);
+ DisplayVocabulary.PRIMARY_SEARCH_INDEX_URI, displayOntModel);
editConfig.setProhibitedFromSearch(pfs);
}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/CloneEntityServlet.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/CloneEntityServlet.java
index a55afe93c..429116d3f 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/CloneEntityServlet.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/CloneEntityServlet.java
@@ -102,8 +102,6 @@ public class CloneEntityServlet extends BaseEditController {
propertyInstanceDao.insertProp(currPI);
}
- // addIndividualToLuceneIndex( context, cloneURI );
-
String encodedCloneURI = URLEncoder.encode(cloneURI, "UTF-8");
response.sendRedirect("entityEdit?uri="+encodedCloneURI);
//response.sendRedirect("entity?home="+portalIdStr+"&id="+newEntityId);
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/DisplayVocabulary.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/DisplayVocabulary.java
index cab2a0508..01fd1c2f8 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/DisplayVocabulary.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/DisplayVocabulary.java
@@ -26,7 +26,7 @@ public class DisplayVocabulary {
private static final String NS = DISPLAY_NS;
/* Individuals */
- public static final String PRIMARY_LUCENE_INDEX_URI = NS + "PrimaryLuceneIndex";
+ public static final String PRIMARY_SEARCH_INDEX_URI = NS + "PrimarySearchIndex";
//bk392 for extracting properties beyond context nodes.
public static final String CONTEXT_NODES_URI = NS + "QueryForContextNodes";
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/VClassGroupDaoJena.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/VClassGroupDaoJena.java
index 9538e7837..05d29bc87 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/VClassGroupDaoJena.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/VClassGroupDaoJena.java
@@ -320,7 +320,7 @@ public class VClassGroupDaoJena extends JenaBaseDao implements VClassGroupDao {
public void removeClassesHiddenFromSearch(List groups) {
OntModel displayOntModel = getOntModelSelector().getDisplayModel();
ProhibitedFromSearch pfs = new ProhibitedFromSearch(
- DisplayVocabulary.PRIMARY_LUCENE_INDEX_URI, displayOntModel);
+ DisplayVocabulary.PRIMARY_SEARCH_INDEX_URI, displayOntModel);
for (VClassGroup group : groups) {
List classList = new ArrayList();
for (VClass vclass : group.getVitroClassList()) {
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/DefaultObjectPropertyFormGenerator.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/DefaultObjectPropertyFormGenerator.java
index 9d78d2523..47c7978d1 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/DefaultObjectPropertyFormGenerator.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/DefaultObjectPropertyFormGenerator.java
@@ -266,7 +266,7 @@ public class DefaultObjectPropertyFormGenerator implements EditConfigurationGene
// .getAttribute("displayOntModel");
// if (displayOntModel != null) {
// ProhibitedFromSearch pfs = new ProhibitedFromSearch(
-// DisplayVocabulary.PRIMARY_LUCENE_INDEX_URI, displayOntModel);
+// DisplayVocabulary.PRIMARY_SEARCH_INDEX_URI, displayOntModel);
// if( editConfiguration != null )
// editConfiguration.setProhibitedFromSearch(pfs);
// }
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/MenuEditingFormGenerator.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/MenuEditingFormGenerator.java
index bc9bc3977..b47f8f097 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/MenuEditingFormGenerator.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/MenuEditingFormGenerator.java
@@ -476,7 +476,7 @@ public class MenuEditingFormGenerator implements EditConfigurationGenerator {
.getAttribute("displayOntModel");
if (displayOntModel != null) {
ProhibitedFromSearch pfs = new ProhibitedFromSearch(
- DisplayVocabulary.PRIMARY_LUCENE_INDEX_URI, displayOntModel);
+ DisplayVocabulary.PRIMARY_SEARCH_INDEX_URI, displayOntModel);
if( editConfiguration != null )
editConfiguration.setProhibitedFromSearch(pfs);
}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/VitroSearchTermNames.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/VitroSearchTermNames.java
index 7ccfb8b4d..f35586b77 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/VitroSearchTermNames.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/VitroSearchTermNames.java
@@ -5,7 +5,7 @@ package edu.cornell.mannlib.vitro.webapp.search;
public class VitroSearchTermNames {
/** Id of entity, vclass or tab */
public static String URI = "URI";
- /** lucene document id */
+ /** search document id */
public static String DOCID = "DocId";
/** java class of the object that the Doc represents. */
public static String JCLASS = "JCLASS";
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/Searcher.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/Searcher.java
deleted file mode 100755
index fdf5b716a..000000000
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/Searcher.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $This file is distributed under the terms of the license in /doc/license.txt$ */
-
-package edu.cornell.mannlib.vitro.webapp.search.beans;
-
-import java.util.List;
-
-import edu.cornell.mannlib.vitro.webapp.search.SearchException;
-
-import edu.cornell.mannlib.vitro.webapp.search.beans.VitroHighlighter;
-import edu.cornell.mannlib.vitro.webapp.search.beans.VitroQuery;
-import edu.cornell.mannlib.vitro.webapp.search.beans.VitroQueryFactory;
-
-/**
- * This is used by the SearchController. Any search back end should
- * implement this.
- *
- * Currently we use LuceneSearcher. It gets setup by LuceneSetup which
- * is specified to run as a listener in the application's web.xml.
- *
- * @author bdc34
- *
- * @ deprecated Use LuceneIndexFactory instead
- */
-public interface Searcher {
-
- public VitroQueryFactory getQueryFactory();
-
- /**
- * return a list of object that are related to the query.
- * The objects should be of type Entity or Tab, if not they
- * will be ignored.
- * @param query
- * @return
- * @throws SearchException
- */
- public List search( VitroQuery query ) throws SearchException;
-
- /**
- * The searcher may need to be used when making a highlighter.
- * In Lucene the highlighter needs access to the index.
- * @param q
- * @return
- */
- // public abstract VitroHighlighter getHighlighter(VitroQuery q);
-
- /**
- * Used to close the searcher if the index that it was using gets
- * deleted.
- */
- public void close();
-}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/VitroHighlighter.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/VitroHighlighter.java
deleted file mode 100644
index 94817ded9..000000000
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/VitroHighlighter.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/* $This file is distributed under the terms of the license in /doc/license.txt$ */
-
-package edu.cornell.mannlib.vitro.webapp.search.beans;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import net.sf.jga.fn.UnaryFunctor;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
-import edu.cornell.mannlib.vitro.webapp.beans.Individual;
-import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
-
-/**
- * Interface for classes that highlight search results.
- * All method must gracefully deal with null inputs.
- *
- * @author bdc34
- *
- * @ deprecated there is no replacement
- */
-public abstract class VitroHighlighter extends UnaryFunctor {
-
- private static final Log log = LogFactory.getLog(VitroHighlighter.class.getName());
-
- public static String preTag = "";
- public static String postTag = "";
-
- public abstract String highlight(String in );
- public abstract String getHighlightFragments(String in );
-
- public String fn(String in){
- if( in == null || "".equals(in))
- return "";
- try{
- return highlight( in );
- }catch(Throwable th){
- return in;
- }
- }
-
- public void highlight(Individual ent){
- if( ent == null)
- return;
-
- ent.setName( this.highlight(ent.getName()));
- Iterator edIt = ent.getDataPropertyStatements().iterator();
- while (edIt.hasNext()) {
- DataPropertyStatement dataPropertyStmt = (DataPropertyStatement)edIt.next();
- dataPropertyStmt.setData(this.highlight(dataPropertyStmt.getData()));
- }
- edIt = ent.getObjectPropertyStatements().iterator();
- /* works only if JSP doesn't escape the text
- while (edIt.hasNext()) {
- ObjectPropertyStatement objectPropertyStmt = (ObjectPropertyStatement)edIt.next();
- Individual object = objectPropertyStmt.getObject();
- object.setName(this.highlight(object.getName()));
- }
- */
- }
-
- /**
- * Highlights the name and then replaces the description with
- * highlighted fragments.
- * @param ent
- */
- public void fragmentHighlight(Individual ent){
- if( ent == null )
- return;
-
- //highlight the name, anchor and moniker and place back in entity object
- if( ent.getName() != null )
- ent.setName( highlight( stripHtml(ent.getName() )));
-
- //make a buffer of text to use the fragmenting hightlighter on
- StringBuffer sb = new StringBuffer("");
- if(ent.getDataPropertyStatements() != null) {
- Iterator edIt = ent.getDataPropertyStatements().iterator();
- while (edIt.hasNext()) {
- sb.append(((DataPropertyStatement)edIt.next()).getData());
- sb.append(' ');
- }
- }
- if(ent.getObjectPropertyStatements() != null) {
- Iterator edIt = ent.getObjectPropertyStatements().iterator();
- while (edIt.hasNext()) {
- String t;
- try {
- ObjectPropertyStatement stmt = (ObjectPropertyStatement) edIt.next();
- sb.append( ( (t = stmt.getProperty().getDomainPublic()) != null) ? t : "" );
- sb.append(' ');
- sb.append( ( (t = stmt.getObject().getName()) != null) ? t : "" );
- sb.append(' ');
- } catch (Exception e) {
- log.info("Error highlighting object property statement for individual "+ent.getURI());
- }
- }
- }
- }
-
- private final String stripHtml(String in){
- /* make a string with html stripped out */
- // ryounes 5/16/2011 Broken with upgrade to Solr 3.1: HTMLStripReader has been removed.
- // According to change list, should use HTMLStripCharFilter, but it's not immediately clear how
- // to migrate this code. Will enter Jira issue.
-// Reader stripIn = new HTMLStripReader( new StringReader( in ) );
-// StringWriter stripOut = new StringWriter(in.length());
-//
-// char bytes[] = new char[5000];
-// int bytesRead = 0;
-// try {
-// //this is a mess, there must be a better way to do this.
-// while ( true ){
-// bytesRead = stripIn.read( bytes );
-// if( bytesRead == -1 ) break;
-// stripOut.write(bytes, 0, bytesRead );
-// }
-// } catch (IOException e1) {
-// log.error("LuceneHighlighter.getHighlightFragments()" +
-// " - unable to strip html" + e1);
-// }
-// return stripOut.toString();
- return in;
- }
-}
-
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/VitroQueryWrapper.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/VitroQueryWrapper.java
index 064118477..7507d37b5 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/VitroQueryWrapper.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/VitroQueryWrapper.java
@@ -13,14 +13,12 @@ public class VitroQueryWrapper {
private VitroQuery query = null;
private int requestCount = 0;
private long searchTime = 0;
- private VitroHighlighter highlighter;
- public VitroQueryWrapper(VitroQuery q, VitroHighlighter hi, int reqCount, long d){
+ public VitroQueryWrapper(VitroQuery q, int reqCount, long d){
this.setSearchTime(d);
this.setQuery(q);
this.setRequestCount(reqCount);
- this.highlighter = hi;
}
public long getSearchTime() {
@@ -42,6 +40,4 @@ public class VitroQueryWrapper {
this.requestCount = requestCount;
}
- public VitroHighlighter getHighlighter(){ return highlighter; }
-
}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/IndexController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/IndexController.java
index 4930b33a5..4924b558f 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/IndexController.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/IndexController.java
@@ -24,8 +24,8 @@ import edu.cornell.mannlib.vitro.webapp.search.indexing.IndexBuilder;
*
* That IndexBuilder will be associated with a object that implements the IndexerIface.
*
- * An example of the IndexerIface is LuceneIndexer.
- * An example of the IndexBuilder and LuceneIndexer getting setup is in LuceneSetup.
+ * An example of the IndexerIface is SolrIndexer.
+ * An example of the IndexBuilder and SolrIndexer setup is in SolrSetup.
*
* @author bdc34
*/
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/SolrPagedSearchController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/SolrPagedSearchController.java
index fe23dd67e..bebeb1441 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/SolrPagedSearchController.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/SolrPagedSearchController.java
@@ -47,7 +47,6 @@ import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.search.IndexConstants;
import edu.cornell.mannlib.vitro.webapp.search.SearchException;
import edu.cornell.mannlib.vitro.webapp.search.VitroSearchTermNames;
-import edu.cornell.mannlib.vitro.webapp.search.beans.VitroHighlighter;
import edu.cornell.mannlib.vitro.webapp.search.beans.VitroQuery;
import edu.cornell.mannlib.vitro.webapp.search.beans.VitroQueryFactory;
import edu.cornell.mannlib.vitro.webapp.search.solr.SolrSetup;
@@ -63,8 +62,6 @@ import freemarker.template.Configuration;
*
*/
-// This will be renamed to PagedSearchController once everything is using Solr and we can
-// delete the Lucene version.
public class SolrPagedSearchController extends FreemarkerHttpServlet {
private static final long serialVersionUID = 1L;
@@ -615,10 +612,6 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet {
public static final int MAX_QUERY_LENGTH = 500;
- public VitroHighlighter getHighlighter(VitroQuery q) {
- throw new Error("PagedSearchController.getHighlighter() is unimplemented");
- }
-
public VitroQueryFactory getQueryFactory() {
throw new Error("PagedSearchController.getQueryFactory() is unimplemented");
}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/indexing/IndexBuilder.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/indexing/IndexBuilder.java
index 9deef835d..0e67fdf2a 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/indexing/IndexBuilder.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/indexing/IndexBuilder.java
@@ -22,7 +22,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
* The IndexBuilder is used to rebuild or update a search index.
* There should only be one IndexBuilder in a vitro web application.
* It uses an implementation of a back-end through an object that
- * implements IndexerIface. An example of a back-end is LuceneIndexer.
+ * implements IndexerIface. An example of a back-end is SolrIndexer.
*
* See the class SearchReindexingListener for an example of how a model change
* listener can use an IndexBuilder to keep the full text index in sncy with
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/indexing/IndexerIface.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/indexing/IndexerIface.java
index 8c5ff126b..0fa5938bf 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/indexing/IndexerIface.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/indexing/IndexerIface.java
@@ -13,8 +13,8 @@ import edu.cornell.mannlib.vitro.webapp.search.docbuilder.Obj2DocIface;
* IndexBuilder will manage getting lists of object to index and then use
* an object that implements IndexerIface to stuff the backend index.
*
- * An example is LuceneIndexer which is set up and associated with a
- * IndexBuilder in LuceneSetup.
+ * An example is SolrIndexer which is set up and associated with a
+ * IndexBuilder in SolrSetup.
*
* @author bdc34
*
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/CustomSimilarity.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/CustomSimilarity.java
deleted file mode 100644
index 880fae449..000000000
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/CustomSimilarity.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $This file is distributed under the terms of the license in /doc/license.txt$ */
-
-package edu.cornell.mannlib.vitro.webapp.search.lucene;
-
-import org.apache.lucene.search.DefaultSimilarity;
-
-public class CustomSimilarity extends DefaultSimilarity {
-
- public CustomSimilarity(){}
-
- /**
- * According to Lucene Javadoc, idf computes a score factor
- * based on a term's document frequency (the number of documents
- * that contain the term).
- *
- * idf = log(numDocs/(docFreq + 1))
- *
- * From this formula we see that, the lower the value of docFreq
- * higher the value of idf. In other words, rare terms have higher
- * idf scores.
- *
- * Returning a value of 1.0f here for idf, since we wan't the
- * rarity of a term not to effect the score of a document.
- *
- * bk392 3/29/2011
- */
- @Override
- public float idf(int docFreq, int numDocs){
- return 1.0f;
- }
-
-
- /**
- * Coord computes a score factor based on the fraction of all query terms
- * that a document contains. The default implementation is
- *
- * coord = (overlap/ maxOverlap)
- *
- * overlap is the number of queryterms matched in the document and maxOverlap
- * is the total number of terms present in the query. That means, more number of
- * query terms matched in a document, higher the score. Here, we are returning a
- * value of 1.0f to override this effect.
- */
- @Override
- public float coord(int overlap, int maxOverlap){
- return 1.0f;
- }
-
- /**
- * From Lucene Javadoc, lengthNorm computes the normalization value
- * for a given field. These values together with the field boosts, are
- * stored in an index and multiplied into scores for hits on each field by
- * the search code.
- *
- * lengthNorm = 1 / sqrt(numTerms)
- *
- * In other words, the document score is inversely proportional to the number of terms
- * contained in the field of interest. Higher the number, lower the doc score. We don't
- * want this since most of our fields contain single value. (except ALLTEXT and type)
- */
- @Override
- public float lengthNorm(String fieldName, int numTerms){
- return 1.0f;
- }
-}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/Entity2LuceneDoc.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/Entity2LuceneDoc.java
deleted file mode 100644
index 3bc34697d..000000000
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/Entity2LuceneDoc.java
+++ /dev/null
@@ -1,375 +0,0 @@
-/* $This file is distributed under the terms of the license in /doc/license.txt$ */
-
-package edu.cornell.mannlib.vitro.webapp.search.lucene;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-import org.apache.lucene.index.Term;
-import org.joda.time.DateTime;
-
-import com.hp.hpl.jena.vocabulary.OWL;
-
-import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
-import edu.cornell.mannlib.vitro.webapp.beans.Individual;
-import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
-import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
-import edu.cornell.mannlib.vitro.webapp.beans.VClass;
-import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
-import edu.cornell.mannlib.vitro.webapp.search.IndexingException;
-
-import edu.cornell.mannlib.vitro.webapp.search.beans.IndividualProhibitedFromSearch;
-import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
-import edu.cornell.mannlib.vitro.webapp.search.docbuilder.Obj2DocIface;
-
-/**
- * This class expect that Entities passed to it will have
- * a VClass object and a list of keywords. The entity should
- * be as full as possible.
- */
-public class Entity2LuceneDoc implements Obj2DocIface{
-
- /** These are the terms for the lucene index */
- public static class VitroLuceneTermNames{
- /** Id of entity, vclass or tab */
- public static String URI = "URI";
- /** lucene document id */
- public static String DOCID = "DocId";
- /** java class of the object that the Doc represents. */
- public static String JCLASS = "JCLASS";
- /** rdf:type */
- public static String RDFTYPE = "type";
- /** rdf:type */
- public static String CLASSGROUP_URI = "classgroup";
- /** Modtime from db */
- public static String MODTIME = "modTime";
-
- /** time of index in msec since epoc */
- public static String INDEXEDTIME= "indexedTime";
- /** text for 'full text' search, this is stemmed */
- public static String ALLTEXT = "ALLTEXT";
- /** text for 'full text' search, this is unstemmed for
- * use with wildcards and prefix queries */
- public static String ALLTEXTUNSTEMMED = "ALLTEXTUNSTEMMED";
- /** class name for storing context nodes **/
- public static final String CONTEXTNODE = "contextNode";
- /** Does the individual have a thumbnail image? 1=yes 0=no */
- public static final String THUMBNAIL = "THUMBNAIL";
- /** Should individual be included in full text search results? 1=yes 0=no */
- public static final String PROHIBITED_FROM_TEXT_RESULTS = "PROHIBITED_FROM_TEXT_RESULTS";
- /** class names in human readable form of an individual*/
- public static final String CLASSLOCALNAMELOWERCASE = "classLocalNameLowerCase";
- /** class names in human readable form of an individual*/
- public static final String CLASSLOCALNAME = "classLocalName";
-
- // Fields derived from rdfs:label
- /** Raw rdfs:label: no lowercasing, no tokenizing, no stop words, no stemming.
- * Used only in retrieval rather than search. **/
- public static String NAME_RAW = "nameRaw"; // was NAMERAW
-
- /** rdfs:label lowercased, no tokenizing, no stop words, no stemming **/
- public static String NAME_LOWERCASE = "nameLowercase"; // was NAMELOWERCASE
-
- /** Same as NAME_LOWERCASE, but single-valued so it's sortable. **/
- // RY Need to control how indexing selects which of multiple values to copy.
- public static String NAME_LOWERCASE_SINGLE_VALUED = "nameLowercaseSingleValued";
-
- /** rdfs:label lowercased, tokenized, stop words, no stemming.
- * Used for autocomplete matching on proper names. **/
- public static String NAME_UNSTEMMED = "nameUnstemmed"; // was NAMEUNSTEMMED
-
- /** rdfs:label lowercased, tokenized, stop words, stemmed.
- * Used for autocomplete matching where stemming is desired (e.g., book titles) **/
- public static String NAME_STEMMED = "nameStemmed"; // was NAME
-
- }
-
- private static final Log log = LogFactory.getLog(Entity2LuceneDoc.class.getName());
-
- public static String earliestTime = "16000101";
- public static String latestTime = "30000101";
-
- /** a way to get to the term names for the lucene index */
- public static VitroLuceneTermNames term = new VitroLuceneTermNames();
-
- private static String entClassName = Individual.class.getName();
-
- private ProhibitedFromSearch classesProhibitedFromSearch;
-
- private IndividualProhibitedFromSearch individualProhibited;
-
- private static HashMap IndividualURIToObjectProperties = new HashMap();
-
- private static HashSet objectProperties = new HashSet();
-
- public Entity2LuceneDoc(
- ProhibitedFromSearch classesProhibitedFromSearch,
- IndividualProhibitedFromSearch individualProhibited){
- this.classesProhibitedFromSearch = classesProhibitedFromSearch;
- this.individualProhibited = individualProhibited;
- }
-
- public boolean canTranslate(Object obj) {
- return (obj != null && obj instanceof Individual);
- }
-
- @SuppressWarnings("static-access")
- public Object translate(Object obj) throws IndexingException {
- if(!( obj instanceof Individual))
- return null;
- Individual ent = (Individual)obj;
- String value;
- Document doc = new Document();
- String classPublicNames = "";
-
- //DocId
- String id = ent.getURI();
- log.debug("translating " + id);
-
- if( id == null ){
- log.debug("cannot add individuals without URIs to lucene index");
- return null;
- }else if( id.startsWith( VitroVocabulary.vitroURI )
- || id.startsWith( VitroVocabulary.VITRO_PUBLIC )
- || id.startsWith( VitroVocabulary.PSEUDO_BNODE_NS)
- || id.startsWith( OWL.NS ) ){
- log.debug("not indxing because of namespace:" + id );
- return null;
- }
-
- //filter out class groups, owl:ObjectProperties etc.
- if( individualProhibited.isIndividualProhibited( id ) ){
- return null;
- }
-
- /* Types and ClassGroup */
- boolean prohibited = false;
- List vclasses = ent.getVClasses(false);
- for( VClass clz : vclasses){
- if( clz.getURI() == null ){
- continue;
- }else if( OWL.Thing.getURI().equals( clz.getURI()) ){
- //index individuals of type owl:Thing, just don't add owl:Thing the type field in the index
- continue;
- } else if ( clz.getURI().startsWith( OWL.NS ) ){
- log.debug("not indexing " + id + " because of type " + clz.getURI());
- return null;
- }else{
- if( !prohibited && classesProhibitedFromSearch.isClassProhibitedFromSearch(clz.getURI()) )
- prohibited = true;
-
- if( clz.getSearchBoost() != null )
- doc.setBoost( doc.getBoost() + clz.getSearchBoost() );
-
- Field typeField = new Field (term.RDFTYPE, clz.getURI(), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS);
- doc.add( typeField);
-
- if(clz.getLocalName() != null){
- Field classLocalName = new Field(term.CLASSLOCALNAME, clz.getLocalName(), Field.Store.YES, Field.Index.ANALYZED);
- Field classLocalNameLowerCase = new Field(term.CLASSLOCALNAMELOWERCASE, clz.getLocalName().toLowerCase(), Field.Store.YES, Field.Index.ANALYZED);
- doc.add(classLocalName);
- doc.add(classLocalNameLowerCase);
- }
-
- if( clz.getName() != null )
- classPublicNames = classPublicNames + " " + clz.getName();
-
- //Classgroup URI
- if( clz.getGroupURI() != null ){
- Field classGroupField = new Field(term.CLASSGROUP_URI, clz.getGroupURI(),
- Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS);
- // classGroupField.setBoost(FIELD_BOOST);
- doc.add(classGroupField);
- }
- }
- }
- doc.add( new Field(term.PROHIBITED_FROM_TEXT_RESULTS, prohibited?"1":"0",
- Field.Store.NO,Field.Index.NOT_ANALYZED_NO_NORMS) );
-
- /* lucene DOCID */
- doc.add( new Field(term.DOCID, entClassName + id,
- Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
-
-
- //vitro Id
- doc.add( new Field(term.URI, id, Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
-
-
- //java class
- doc.add( new Field(term.JCLASS, entClassName, Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
-
- // Individual label
- if( ent.getRdfsLabel() != null )
- value=ent.getRdfsLabel();
- else{
- //log.debug("Skipping individual without rdfs:label " + ent.getURI());
- //return null;
- log.debug("Using local name for individual with rdfs:label " + ent.getURI());
- value = ent.getLocalName();
- }
- Field nameRaw = new Field(term.NAME_RAW, value, Field.Store.YES, Field.Index.NOT_ANALYZED);
- nameRaw.setBoost(NAME_BOOST);
- doc.add(nameRaw);
-
- // RY Not sure if we need to store this. For Solr, see schema.xml field definition.
- Field nameLowerCase = new Field(term.NAME_LOWERCASE, value.toLowerCase(), Field.Store.YES, Field.Index.NOT_ANALYZED);
- nameLowerCase.setBoost(NAME_BOOST);
- doc.add(nameLowerCase);
-
- Field nameUnstemmed = new Field(term.NAME_UNSTEMMED, value, Field.Store.NO, Field.Index.ANALYZED);
- nameUnstemmed.setBoost(NAME_BOOST);
- doc.add(nameUnstemmed);
-
- Field nameStemmed = new Field(term.NAME_STEMMED, value, Field.Store.NO, Field.Index.ANALYZED);
- nameStemmed.setBoost(NAME_BOOST);
- doc.add(nameStemmed);
-
- String contextNodePropertyValues;
-
-// if(ent.isVClass("http://xmlns.com/foaf/0.1/Person")){
- /*contextNodePropertyValues = searchQueryHandler.getPropertiesAssociatedWithEducationalTraining(ent.getURI());
- contextNodePropertyValues += searchQueryHandler.getPropertiesAssociatedWithRole(ent.getURI());
- contextNodePropertyValues += searchQueryHandler.getPropertiesAssociatedWithPosition(ent.getURI());
- contextNodePropertyValues += searchQueryHandler.getPropertiesAssociatedWithRelationship(ent.getURI());
- contextNodePropertyValues += searchQueryHandler.getPropertiesAssociatedWithAwardReceipt(ent.getURI());
- contextNodePropertyValues += searchQueryHandler.getPropertiesAssociatedWithInformationResource(ent.getURI()); */
-
-// }
-
- /* Field contextNodeInformation = new Field(term.CONTEXTNODE, contextNodePropertyValues, Field.Store.YES, Field.Index.ANALYZED );
- doc.add(contextNodeInformation);*/
-
- //boost for entity
- if( ent.getSearchBoost() != null && ent.getSearchBoost() != 0 )
- doc.setBoost(ent.getSearchBoost());
-
- //Modification time
-// if( ent.getModTime() != null){
-// value = (new DateTime(ent.getModTime().getTime()))
-// .toString(LuceneIndexer.MODTIME_DATE_FORMAT) ;
-// } else {
-// value= (new DateTime()).toString(LuceneIndexer.MODTIME_DATE_FORMAT) ;
-// }
-// doc.add( new Field(term.MODTIME, value , Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
-
- /* thumbnail */
- try{
- value = null;
- if( ent.hasThumb() )
- doc.add(new Field(term.THUMBNAIL, "1", Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
- else
- doc.add(new Field(term.THUMBNAIL, "0", Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
- }catch(Exception ex){
- log.debug("could not index thumbnail: " + ex);
- }
-
-
- //time of index in millis past epoc
- Object anon[] = { new Long((new DateTime() ).getMillis()) };
- doc.add( new Field(term.INDEXEDTIME, String.format( "%019d", anon ),
- Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
-
-
- if( ! prohibited ){
- //ALLTEXT, all of the 'full text'
- String t=null;
- value ="";
- value+= " "+( ((t=ent.getName()) == null)?"":t );
- value+= " "+ getKeyterms(ent);
-
- value+= " " + classPublicNames;
-
- List dataPropertyStatements = ent.getDataPropertyStatements();
- if (dataPropertyStatements != null) {
- Iterator dataPropertyStmtIter = dataPropertyStatements.iterator();
- while (dataPropertyStmtIter.hasNext()) {
- DataPropertyStatement dataPropertyStmt = dataPropertyStmtIter.next();
- value+= " "+ ( ((t=dataPropertyStmt.getData()) == null)?"":t );
- }
- }
-
- List objectPropertyStatements = ent.getObjectPropertyStatements();
- if (objectPropertyStatements != null) {
- Iterator objectPropertyStmtIter = objectPropertyStatements.iterator();
- while (objectPropertyStmtIter.hasNext()) {
- ObjectPropertyStatement objectPropertyStmt = objectPropertyStmtIter.next();
- if( "http://www.w3.org/2002/07/owl#differentFrom".equals(objectPropertyStmt.getPropertyURI()) )
- continue;
- try {
- value+= " "+ ( ((t=objectPropertyStmt.getObject().getName()) == null)?"":t );
-
- if(ent.isVClass("http://xmlns.com/foaf/0.1/Person")){
- //IndividualURIToObjectProperties.put(ent.getURI(), ( ((t=objectPropertyStmt.getProperty().getURI()) == null)?"":t ) );
- objectProperties.add(( ((t=objectPropertyStmt.getProperty().getURI()) == null)?"":t ));
- }
-
- } catch (Exception e) {
- log.debug("could not index name of related object: " + e.getMessage());
- }
- }
- }
- //stemmed terms
- doc.add( new Field(term.ALLTEXT, value , Field.Store.NO, Field.Index.ANALYZED));
- //unstemmed terms
- doc.add( new Field(term.ALLTEXTUNSTEMMED, value, Field.Store.NO, Field.Index.ANALYZED));
- }
-
-
- // log.info("\n IndividualURItoObjectProperties " + IndividualURIToObjectProperties.toString() + " \n\n");
- log.info(" \n Object Properties " + objectProperties.toString() + "\n\n");
-
- return doc;
- }
-
- @SuppressWarnings("static-access")
- public boolean canUnTranslate(Object result) {
- if( result != null && result instanceof Document){
- Document hit = (Document) result;
- if( entClassName.equalsIgnoreCase(hit.get(term.JCLASS)) ){
- return true;
- }
- }
- return false;
- }
-
- @SuppressWarnings("static-access")
- public Object unTranslate(Object result) {
- Individual ent = null;
- if( result != null && result instanceof Document){
- Document hit = (Document) result;
- String id = hit.get(term.URI);
- ent = new IndividualImpl();
- ent.setURI(id);
- }
- return ent;
- }
-
- @SuppressWarnings("static-access")
- public Object getIndexId(Object obj) {
- return new Term(term.DOCID, entClassName + ((Individual)obj).getURI() ) ;
- }
-
- private String getKeyterms(Individual ent){
- /* bdc34: vitro:keywords are no longer being indexed */
- return "";
- }
-
- public ProhibitedFromSearch getClassesProhibitedFromSearch() {
- return classesProhibitedFromSearch;
- }
-
- public void setClassesProhibitedFromSearch(
- ProhibitedFromSearch classesProhibitedFromSearch) {
- this.classesProhibitedFromSearch = classesProhibitedFromSearch;
- }
-
- public static float NAME_BOOST = 3.0F;
- public static float MONIKER_BOOST = 2.0F;
- public static float FIELD_BOOST = 1.0F;
-}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/HtmlLowerStopAnalyzer.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/HtmlLowerStopAnalyzer.java
deleted file mode 100644
index e6a32bed7..000000000
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/HtmlLowerStopAnalyzer.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/* $This file is distributed under the terms of the license in /doc/license.txt$ */
-
-package edu.cornell.mannlib.vitro.webapp.search.lucene;
-
-import java.io.Reader;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.lucene.analysis.ASCIIFoldingFilter;
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.LowerCaseFilter;
-import org.apache.lucene.analysis.StopFilter;
-import org.apache.lucene.analysis.TokenStream;
-import org.apache.lucene.analysis.standard.StandardFilter;
-import org.apache.lucene.analysis.standard.StandardTokenizer;
-import org.apache.lucene.util.Version;
-
-public class HtmlLowerStopAnalyzer extends Analyzer {
- /* much of this code is from
- * http://www.onjava.com/pub/a/onjava/2003/01/15/lucene.html?page=2
- * bdc34
- */
-
- private static Set _stopWords;
-
- /**
- * An array containing some common English words
- * that are usually not useful for searching.
- */
- public static final String[] STOP_WORDS =
- {
- "0", "1", "2", "3", "4", "5", "6", "7", "8",
- "9", "000", "$",
- "about", "after", "all", "also", "an", "and",
- "another", "any", "are", "as", "at", "be",
- "because", "been", "before", "being", "between",
- "both", "but", "by", "came", "can", "come",
- "could", "did", "do", "does", "each", "else",
- "for", "from", "get", "got", "has", "had",
- "he", "have", "her", "here", "him", "himself",
- "his", "how","if", "in", "into", "is", "it",
- "its", "just", "like", "make", "many", "me",
- "might", "more", "most", "much", "must", "my",
- "never", "now", "of", "on", "only", "or",
- "other", "our", "out", "over", "re", "said",
- "same", "see", "should", "since", "so", "some",
- "still", "such", "take", "than", "that", "the",
- "their", "them", "then", "there", "these",
- "they", "this", "those", "through", "to", "too",
- "under", "up", "use", "very", "want", "was",
- "way", "we", "well", "were", "what", "when",
- "where", "which", "while", "who", "will",
- "with", "would", "you", "your",
- "a", "b", "c", "d", "e", "f", "g", "h", "i",
- "j", "k", "l", "m", "n", "o", "p", "q", "r",
- "s", "t", "u", "v", "w", "x", "y", "z"
- };
-
- public static final List stopWordsList = Arrays.asList(STOP_WORDS);
- public static final Set STOP_WORDS_SET = new HashSet(stopWordsList);
-
- /**
- * Builds an analyzer.
- */
- public HtmlLowerStopAnalyzer()
- {
- this(STOP_WORDS_SET);
- }
-
- /**
- * Builds an analyzer with the given stop words.
- *
- * @param stopWords a String array of stop words
- */
- public HtmlLowerStopAnalyzer(Set stopWords)
- {
- _stopWords = STOP_WORDS_SET;
- }
-
- /**
- * Processes the input by first converting it to
- * lower case, then by eliminating stop words.
- *
- * @param reader the Reader that
- * provides access to the input text
- * @return an instance of TokenStream
- */
-
- public TokenStream tokenStream(String fieldName, Reader arg0) {
- //ignore fieldName, tokenize all fields the same way.
-
- /* With this we are pipeing the output of the inner most
- * Reader outwards.
- * Input-> HtmlStrip-> LowerCase-> stopFilter-> StemFilter-> Output
- */
-// TokenStream htmlStripAndLower =
-// new LowerCaseTokenizer(arg0 );
-//
-//
-// boolean IGNORE_CASE = true;
-// TokenFilter stopFilter =
-// new StopFilter(htmlStripAndLower,STOP_WORDS , IGNORE_CASE) ;
-//
-// return stopFilter;
-//
-
- TokenStream result = new StandardTokenizer(Version.LUCENE_29, arg0);
- result = new StandardFilter(result); //break into tokens
- result = new LowerCaseFilter(result); //lower case
- result = new StopFilter(ENABLE_POSITION_INCREMENTS, result, STOP_WORDS_SET, IGNORE_CASE); //remove stop words
- result = new ASCIIFoldingFilter(result); //this class converts alphabetic, symbolic and numerical characters into their ASCII equivalents.
- return result;
-
- }
-
- private static final boolean IGNORE_CASE = true;
- private static final boolean ENABLE_POSITION_INCREMENTS = false;
-
-}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/HtmlLowerStopStemAnalyzer.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/HtmlLowerStopStemAnalyzer.java
deleted file mode 100644
index 3abdfbecd..000000000
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/HtmlLowerStopStemAnalyzer.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $This file is distributed under the terms of the license in /doc/license.txt$ */
-
-package edu.cornell.mannlib.vitro.webapp.search.lucene;
-
-import java.io.Reader;
-import java.util.Set;
-
-import org.apache.lucene.analysis.PorterStemFilter;
-import org.apache.lucene.analysis.TokenStream;
-
-/**
- * A Analyzer that strips html, lower cases, removes stops and
- * then does porter stemming.
- *
- * @author bdc34
- *
- */
-public class HtmlLowerStopStemAnalyzer extends HtmlLowerStopAnalyzer {
- public HtmlLowerStopStemAnalyzer(){
- super();
- }
-
- public HtmlLowerStopStemAnalyzer(Set stopWords){
- super(stopWords);
- }
-
- /**
- * Processes the input by first converting it to
- * lower case, then by eliminating stop words, and
- * finally by performing Porter stemming on it.
- *
- * @param reader the Reader that
- * provides access to the input text
- * @return an instance of TokenStream
- */
-
- public TokenStream tokenStream(String fieldName, Reader arg0) {
- //ignore fieldName, tokenize all fields the same way.
-
- /* With this we are pipeing the output of the inner most
- * Reader outwards.
- * Input-> HtmlStrip-> LowerCase-> stopFilter-> StemFilter-> Output
- */
- return new PorterStemFilter(super.tokenStream(fieldName,arg0));
- }
-
-}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/LuceneQuery.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/LuceneQuery.java
deleted file mode 100644
index 230c7a2d7..000000000
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/LuceneQuery.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/* $This file is distributed under the terms of the license in /doc/license.txt$ */
-
-package edu.cornell.mannlib.vitro.webapp.search.lucene;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.queryParser.QueryParser;
-import org.apache.lucene.search.Query;
-
-import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
-import edu.cornell.mannlib.vitro.webapp.search.SearchException;
-import edu.cornell.mannlib.vitro.webapp.search.beans.VitroQuery;
-
-/**
- * Creates a query that can be used to search a Lucene index.
- * This class uses the Lucene class QueryParser to parse the
- * text from the html text field input form.
- *
- * For information about how syntaxt and semantics of the
- * QueryParser see:
- * http://lucene.apache.org/java/docs/queryparsersyntax.html
- * http://today.java.net/pub/a/today/2003/11/07/QueryParserRules.html
- *
- * This class is not thread safe, use one instance per request.
- * @author bdc34
- *
- */
-public class LuceneQuery extends VitroQuery {
- private final String defaultSearchField = "ALLTEXT";
-
- private final int SIMPLE = 1;
- private final int ADVANCED =2;
- private int queryType = SIMPLE;
-
- private Query query = null;
- private Analyzer analyzer = null;
-
- private static final Log log = LogFactory.getLog(LuceneQuery.class.getName());
-
- public LuceneQuery(VitroRequest request,
- Analyzer analyzer,
- String defaultField ){
- super(request); //the super class will stash the parameters for us.
- this.analyzer = analyzer;
-
- if( isAdvancedQuery( request ) ){
- queryType = ADVANCED;
- }
- }
-
- @SuppressWarnings("static-access")
- private QueryParser getQueryParser(){
- //defaultSearchField indicates which field search against when there is no term
- //indicated in the query string.
- //The analyzer is needed so that we use the same analyzer on the search queries as
- //was used on the text that was indexed.
- QueryParser qp = new QueryParser(defaultSearchField,analyzer);
- //this sets the query parser to AND all of the query terms it finds.
- qp.setDefaultOperator(QueryParser.AND_OPERATOR);
- return qp;
- }
-
- public Object getQuery() throws SearchException {
- if( this.query != null )
- return this.query;
-
- String querystr = "";
- if( getParameters() != null && getParameters().get(VitroQuery.QUERY_PARAMETER_NAME)!=null ){
- Object obj= getParameters().get(VitroQuery.QUERY_PARAMETER_NAME);
- if( obj instanceof String[])
- querystr = ((String[])obj)[0];
- else
- log.debug("LuceneQquery.getQuery() querytext is of class " +
- obj.getClass().getName());
- }
- else
- throw new SearchException(this.getClass().getName() +
- ": There was no Parameter '"+VitroQuery.QUERY_PARAMETER_NAME+"' in the request.");
-
- try{
- if( SIMPLE == queryType ){
- QueryParser parser= getQueryParser();
- this.query = parser.parse(querystr);
- } else if( ADVANCED == queryType ){
- this.query = null;
- }
- }catch (Exception ex){
- throw new SearchException(ex.getMessage());
- }
-
- return this.query;
- }
-
- /**
- * Check to see if the request came from some sort of advanced query page.
- *
- * @param request
- * @return
- */
- private boolean isAdvancedQuery(HttpServletRequest request){
- return false;
- }
-
- @Override
- public String getTerms() {
- if( getParameters() != null &&
- getParameters().get(VitroQuery.QUERY_PARAMETER_NAME) != null) {
- Object terms = getParameters().get(VitroQuery.QUERY_PARAMETER_NAME);
- if( terms instanceof String[] ) {
- return ((String[])terms)[0];
- } else {
- log.debug("LuceneQuery.getTerms(): terms in a " + terms.getClass().getName() );
- return "";
- }
- } else
- return "";
- }
-
- public Analyzer getAnalyzer(){return analyzer;}
-}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/LuceneQueryFactory.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/LuceneQueryFactory.java
deleted file mode 100644
index bee44c60b..000000000
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/lucene/LuceneQueryFactory.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/* $This file is distributed under the terms of the license in /doc/license.txt$ */
-
-package edu.cornell.mannlib.vitro.webapp.search.lucene;
-
-import org.apache.lucene.analysis.Analyzer;
-
-import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
-import edu.cornell.mannlib.vitro.webapp.search.SearchException;
-import edu.cornell.mannlib.vitro.webapp.search.beans.VitroQuery;
-import edu.cornell.mannlib.vitro.webapp.search.beans.VitroQueryFactory;
-
-public class LuceneQueryFactory implements VitroQueryFactory {
-
- public static final int MAX_QUERY_LENGTH = 500;
- private String defaultField;
- private Analyzer analyzer = null;
-
- public LuceneQueryFactory(Analyzer analyzer, String defaultField ){
- this.analyzer = analyzer;
- this.defaultField = defaultField;
- }
-
- public VitroQuery getQuery(VitroRequest request) throws SearchException {
- //there should be a better way to integrate this with LuceneQuery
- //here we check that the request has the parameters that we need to
- //make the query. If it does not then we return null.
- String txt = request.getParameter(VitroQuery.QUERY_PARAMETER_NAME);
- if( txt == null || txt.length() == 0 )
- return null;
- if( txt.length() > MAX_QUERY_LENGTH )
- throw new SearchException("The search was too long. The maximum " +
- "query length is " + MAX_QUERY_LENGTH );
- LuceneQuery query = new LuceneQuery(request, analyzer, defaultField );
- return query;
- }
-
- public Analyzer getAnalyzer(){
- return analyzer;
- }
-}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/IndividualToSolrDocument.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/IndividualToSolrDocument.java
index 384a8fb4c..e1947f03d 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/IndividualToSolrDocument.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/IndividualToSolrDocument.java
@@ -134,7 +134,7 @@ public class IndividualToSolrDocument {
private void checkForSkipBasedOnNS(Individual ind) throws SkipIndividualException {
String id = ind.getURI();
if(id == null){
- throw new SkipIndividualException("cannot add individuals without URIs to lucene Index");
+ throw new SkipIndividualException("cannot add individuals without URIs to search index");
}else if( id.startsWith(VitroVocabulary.vitroURI) ||
id.startsWith(VitroVocabulary.VITRO_PUBLIC) ||
id.startsWith(VitroVocabulary.PSEUDO_BNODE_NS) ||
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/SolrSetup.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/SolrSetup.java
index 6a28feb72..6b1cf08b3 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/SolrSetup.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/SolrSetup.java
@@ -70,8 +70,7 @@ public class SolrSetup implements javax.servlet.ServletContextListener{
server.setMaxRetries(1);
context.setAttribute(LOCAL_SOLR_SERVER, server);
- /* setup the individual to solr doc translation */
- //first we need a ent2luceneDoc translator
+ /* set up the individual to solr doc translation */
OntModel displayOntModel = (OntModel) sce.getServletContext().getAttribute("displayOntModel");
OntModel abox = ModelContext.getBaseOntModelSelector(context).getABoxModel();
@@ -86,7 +85,7 @@ public class SolrSetup implements javax.servlet.ServletContextListener{
modifiers.add(new NameBoost());
IndividualToSolrDocument indToSolrDoc = new IndividualToSolrDocument(
- new ProhibitedFromSearch(DisplayVocabulary.PRIMARY_LUCENE_INDEX_URI, displayOntModel),
+ new ProhibitedFromSearch(DisplayVocabulary.PRIMARY_SEARCH_INDEX_URI, displayOntModel),
new IndividualProhibitedFromSearchImpl(context),
modifiers);
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/InputElementFormattingTag.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/InputElementFormattingTag.java
index ac110d4d6..8b82337c1 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/InputElementFormattingTag.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/InputElementFormattingTag.java
@@ -449,7 +449,7 @@ public class InputElementFormattingTag extends TagSupport {
.getAttribute("displayOntModel");
if (displayOntModel != null) {
ProhibitedFromSearch pfs = new ProhibitedFromSearch(
- DisplayVocabulary.PRIMARY_LUCENE_INDEX_URI, displayOntModel);
+ DisplayVocabulary.PRIMARY_SEARCH_INDEX_URI, displayOntModel);
if( editConfig != null )
editConfig.setProhibitedFromSearch(pfs);
}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ObjectPropertyStatementTemplateModel.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ObjectPropertyStatementTemplateModel.java
index 300a94184..718a4599c 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ObjectPropertyStatementTemplateModel.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ObjectPropertyStatementTemplateModel.java
@@ -30,7 +30,6 @@ public class ObjectPropertyStatementTemplateModel extends PropertyStatementTempl
private final String objectUri;
private final String templateName;
- //Updating to include Vitro Request
ObjectPropertyStatementTemplateModel(String subjectUri, String propertyUri, String objectKey,
Map data, EditingPolicyHelper policyHelper, String templateName, VitroRequest vreq) {
super(subjectUri, propertyUri, policyHelper, vreq);
diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/search/beans/ProhibitedFromSearchTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/search/beans/ProhibitedFromSearchTest.java
index 8e29ccb24..c2f3cafd8 100644
--- a/webapp/test/edu/cornell/mannlib/vitro/webapp/search/beans/ProhibitedFromSearchTest.java
+++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/search/beans/ProhibitedFromSearchTest.java
@@ -110,7 +110,7 @@ public class ProhibitedFromSearchTest {
@Test
public void testPrimaryIndex(){
String primaryIndexN3 =
- "" +
+ "" +
"" +
" . ";
@@ -119,7 +119,7 @@ public class ProhibitedFromSearchTest {
m.add( r.listStatements() );
Assert.assertTrue(m.size() == 1);
- ProhibitedFromSearch pfs = new ProhibitedFromSearch( DisplayVocabulary.PRIMARY_LUCENE_INDEX_URI, m);
+ ProhibitedFromSearch pfs = new ProhibitedFromSearch( DisplayVocabulary.PRIMARY_SEARCH_INDEX_URI, m);
Assert.assertNotNull(pfs.prohibitedClasses);
Assert.assertEquals(1, pfs.prohibitedClasses.size() );
Assert.assertTrue(pfs.isClassProhibitedFromSearch("http://vivoweb.org/ontology/core#NonAcademic"));
diff --git a/webapp/web/edit/forms/defaultObjPropForm.jsp b/webapp/web/edit/forms/defaultObjPropForm.jsp
index 956f402c6..bf720e703 100644
--- a/webapp/web/edit/forms/defaultObjPropForm.jsp
+++ b/webapp/web/edit/forms/defaultObjPropForm.jsp
@@ -143,7 +143,7 @@
.getAttribute("displayOntModel");
if (displayOntModel != null) {
ProhibitedFromSearch pfs = new ProhibitedFromSearch(
- DisplayVocabulary.PRIMARY_LUCENE_INDEX_URI, displayOntModel);
+ DisplayVocabulary.PRIMARY_SEARCH_INDEX_URI, displayOntModel);
if( editConfig != null )
editConfig.setProhibitedFromSearch(pfs);
}
diff --git a/webapp/web/themes/vitro/templates/page-home.ftl b/webapp/web/themes/vitro/templates/page-home.ftl
index b6a97ebb8..58f90797b 100644
--- a/webapp/web/themes/vitro/templates/page-home.ftl
+++ b/webapp/web/themes/vitro/templates/page-home.ftl
@@ -24,7 +24,7 @@
Create or load ontologies in OWL format
Edit instances and relationships
Build a public web site to display your data
- Search your data with Lucene
+ Search your data