From c022bcbdc23b2956ccc55ad588d47fd4a664ec0d Mon Sep 17 00:00:00 2001 From: felmer <felmer> Date: Mon, 24 Apr 2017 08:17:20 +0000 Subject: [PATCH] SSDM-4925: remove dead code SVN: 38082 --- .../dataaccess/db/HibernateSearchDAO.java | 53 ------------------- .../dto/hibernate/SearchFieldConstants.java | 6 --- 2 files changed, 59 deletions(-) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/HibernateSearchDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/HibernateSearchDAO.java index 965d1cdf3a1..e27d38f6cac 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/HibernateSearchDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/HibernateSearchDAO.java @@ -16,7 +16,6 @@ package ch.systemsx.cisd.openbis.generic.server.dataaccess.db; -import java.io.IOException; import java.io.StringReader; import java.util.ArrayList; import java.util.Collections; @@ -43,7 +42,6 @@ import org.apache.lucene.index.FieldInfo; import org.apache.lucene.index.FieldInfo.DocValuesType; import org.apache.lucene.index.FieldInfos; import org.apache.lucene.index.IndexReader; -import org.apache.lucene.index.IndexReaderContext; import org.apache.lucene.index.IndexableField; import org.apache.lucene.index.Term; import org.apache.lucene.queryparser.classic.QueryParser; @@ -68,7 +66,6 @@ import org.hibernate.search.SearchFactory; import org.hibernate.search.engine.ProjectionConstants; import org.hibernate.search.indexes.spi.DirectoryBasedIndexManager; import org.hibernate.search.indexes.spi.ReaderProvider; -import org.hibernate.search.metadata.IndexedTypeDescriptor; import org.hibernate.search.spi.SearchIntegrator; import org.hibernate.transform.BasicTransformerAdapter; import org.hibernate.transform.ResultTransformer; @@ -821,10 +818,6 @@ final class HibernateSearchDAO extends HibernateDaoSupport implements IHibernate }; } - public Highlighter getRawHighlighter() - { - return highlighter; - } } private static final class MyIndexReaderProvider @@ -833,8 +826,6 @@ final class HibernateSearchDAO extends HibernateDaoSupport implements IHibernate private final IndexReader indexReader; - private final IndexedTypeDescriptor indexedTypeDescriptor; - /** opens the index reader. Closing the index after usage must be done with #close() method. */ public MyIndexReaderProvider(final FullTextSession fullTextSession, final SearchableEntity searchableEntity) @@ -846,7 +837,6 @@ final class HibernateSearchDAO extends HibernateDaoSupport implements IHibernate (DirectoryBasedIndexManager) searchIntegrator.getIndexManager(searchableEntity.getMatchingEntityClass().getSimpleName()); this.readerProvider = indexManager.getReaderProvider(); this.indexReader = readerProvider.openIndexReader(); - this.indexedTypeDescriptor = searchIntegrator.getIndexedTypeDescriptor(searchableEntity.getMatchingEntityClass()); } public IndexReader getReader() @@ -854,49 +844,6 @@ final class HibernateSearchDAO extends HibernateDaoSupport implements IHibernate return indexReader; } - private void collectFields(IndexReaderContext context, Set<String> fields) - { - if (context == null) - { - return; - } - if (context instanceof AtomicReaderContext) - { - try - { - for (String fieldName : ((AtomicReaderContext) context).reader().fields()) - { - fields.add(fieldName); - } - } catch (IOException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - if (context.children() == null) - { - return; - } - for (IndexReaderContext child : context.children()) - { - collectFields(child, fields); - } - - } - - public String[] getIndexedFields() - { - Set<String> fieldNames = new HashSet<String>(); - collectFields(indexReader.getContext(), fieldNames); - fieldNames.remove(SearchFieldConstants.ID); - for (String prefix : SearchFieldConstants.PREFIXES) - { - fieldNames.remove(prefix + SearchFieldConstants.ID); - } - return fieldNames.toArray(new String[fieldNames.size()]); - } - /** must be called to close the index reader when it is not needed anymore */ public void close() { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/hibernate/SearchFieldConstants.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/hibernate/SearchFieldConstants.java index ff87fd00377..c2750f99980 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/hibernate/SearchFieldConstants.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/hibernate/SearchFieldConstants.java @@ -63,12 +63,6 @@ public final class SearchFieldConstants public static final String PREFIX_CONTENT_COPY = "content copy" + SEPARATOR; - public static final String[] PREFIXES = - { PREFIX_PROPERTIES, PREFIX_EXPERIMENT, PREFIX_SAMPLE, PREFIX_ENTITY_TYPE, - PREFIX_FILE_FORMAT_TYPE, PREFIX_FILE_FORMAT_TYPE, PREFIX_PROJECT, PREFIX_SPACE, - PREFIX_REGISTRATOR, PREFIX_ATTACHMENT, PREFIX_PROPERTIES + PREFIX_VOCABULARY_TERM, - PREFIX_METAPROJECT }; - public static final String ID = "id"; public static final String EXPERIMENT_ID = PREFIX_EXPERIMENT + ID; -- GitLab