From de05a040095721771a8191fb97df3e60d48f9ad3 Mon Sep 17 00:00:00 2001 From: briancaruso Date: Mon, 13 Jun 2011 21:33:41 +0000 Subject: [PATCH] Removing LuceneDocToSolrDoc.java it is no longer used. --- .../search/solr/IndividualToSolrDocument.java | 4 +- .../search/solr/LuceneDocToSolrDoc.java | 62 ------------------- 2 files changed, 1 insertion(+), 65 deletions(-) delete mode 100644 webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/LuceneDocToSolrDoc.java 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 dea6ff073..e4479245a 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 @@ -29,9 +29,7 @@ import edu.cornell.mannlib.vitro.webapp.search.beans.IndividualProhibitedFromSea import edu.cornell.mannlib.vitro.webapp.search.docbuilder.Obj2DocIface; public class IndividualToSolrDocument { - - protected LuceneDocToSolrDoc luceneToSolr; - + public static final Log log = LogFactory.getLog(IndividualToSolrDocument.class.getName()); public static VitroTermNames term = new VitroTermNames(); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/LuceneDocToSolrDoc.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/LuceneDocToSolrDoc.java deleted file mode 100644 index cb5e4702b..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/LuceneDocToSolrDoc.java +++ /dev/null @@ -1,62 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.search.solr; - -import org.apache.lucene.document.Document; -import org.apache.lucene.document.Field; -import org.apache.solr.common.SolrDocument; -import org.apache.solr.common.SolrInputDocument; - -import edu.cornell.mannlib.vitro.webapp.beans.Individual; -import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl; -import edu.cornell.mannlib.vitro.webapp.search.IndexingException; -import edu.cornell.mannlib.vitro.webapp.search.docbuilder.Obj2DocIface; -import edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc; - -/** - * Translate a lucene Document into a SolrDocument. - */ -public class LuceneDocToSolrDoc implements Obj2DocIface { - - - @Override - public boolean canTranslate(Object obj) { - return obj != null && obj instanceof Document; - } - - @Override - public boolean canUnTranslate(Object result) { - return result != null && result instanceof SolrDocument; - } - - @Override - public Object getIndexId(Object obj) { - //"this method isn't useful for solr" - return null; - } - - @Override - public Object translate(Object obj) throws IndexingException { - Document luceneDoc = (Document)obj; - SolrInputDocument solrDoc = new SolrInputDocument(); - - for( Object f : luceneDoc.getFields()){ - Field field = (Field)f; - solrDoc.addField( new String(field.name()), field.stringValue() ); - } - return solrDoc; - } - - @Override - public Object unTranslate(Object result) { - Individual ind = null; - if( result != null && result instanceof SolrDocument){ - SolrDocument hit = (SolrDocument)result; - String id = (String) hit.getFieldValue(Entity2LuceneDoc.term.URI); - ind = new IndividualImpl(); - ind.setURI(id); - } - return ind; - } - -}