eu.etaxonomy.cdm.persistence.dao.common
Interface ISearchableDao<T extends CdmBase>

All Known Subinterfaces:
IAgentDao, IClassificationDao, ICollectionDao, IDefinedTermDao, IDescriptionDao, IDescriptionElementDao, IFeatureTreeDao, IIdentifiableDao<T>, IMediaDao, IOccurrenceDao, IPolytomousKeyDao, IReferenceDao, ITaxonDao, ITaxonNameDao, ITermVocabularyDao
All Known Implementing Classes:
AgentDaoImpl, ClassificationDaoHibernateImpl, CollectionDaoHibernateImpl, DefinedTermDaoImpl, DescriptionDaoImpl, DescriptionElementDaoImpl, FeatureTreeDaoImpl, IdentifiableDaoBase, MediaDaoHibernateImpl, OccurrenceDaoHibernateImpl, PolytomousKeyDaoImpl, ReferenceDaoHibernateImpl, TaxonDaoHibernateImpl, TaxonNameDaoHibernateImpl, TermVocabularyDaoImpl

public interface ISearchableDao<T extends CdmBase>


Method Summary
 int count(Class<? extends T> clazz, String queryString)
          Returns a count of T instances where entities match a given queryString (as interpreted by the Lucene QueryParser)
 void optimizeIndex()
          Calls optimize on the relevant index (useful periodically to increase response times on the free-text search)
 void purgeIndex()
          Removes all entities of type T from the index
 void rebuildIndex()
          Index all T entities currently in the database (useful in concert with purgeIndex() to (re-)create indexes or in the case of corrupt indexes / mismatch between the database and the free-text indices)
 List<T> search(Class<? extends T> clazz, String queryString, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths)
          Returns a List of T instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)
 String suggestQuery(String string)
          Suggest a query that will return hits based upon an existing lucene query string (that is presumably misspelt and returns no hits) Used to implement "did you mean?"-type functionality using the lucene spellchecker.
 

Method Detail

count

int count(Class<? extends T> clazz,
          String queryString)
Returns a count of T instances where entities match a given queryString (as interpreted by the Lucene QueryParser)

Parameters:
clazz - filter the results by class (or pass null to count all entities of type T)
queryString -
Returns:
a count of the matching entities
See Also:
Apache Lucene - Query Parser Syntax

search

List<T> search(Class<? extends T> clazz,
               String queryString,
               Integer pageSize,
               Integer pageNumber,
               List<OrderHint> orderHints,
               List<String> propertyPaths)
Returns a List of T instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)

Parameters:
clazz - filter the results by class (or pass null to return all entities of type T)
queryString -
pageSize - The maximum number of entities returned (can be null for all matching entities)
pageNumber - The offset (in pageSize chunks) from the start of the result set (0 - based)
orderHints - Supports path like orderHints.propertyNames which include *-to-one properties like createdBy.username or authorTeam.persistentTitleCache
propertyPaths - properties to be initialized
Returns:
a List T instances
See Also:
Apache Lucene - Query Parser Syntax

suggestQuery

String suggestQuery(String string)
Suggest a query that will return hits based upon an existing lucene query string (that is presumably misspelt and returns no hits) Used to implement "did you mean?"-type functionality using the lucene spellchecker.

Parameters:
string - Query string to check
Returns:
a suggested query string that will return hits or null if no such alternative spelling can be found.

purgeIndex

void purgeIndex()
Removes all entities of type T from the index


rebuildIndex

void rebuildIndex()
Index all T entities currently in the database (useful in concert with purgeIndex() to (re-)create indexes or in the case of corrupt indexes / mismatch between the database and the free-text indices)


optimizeIndex

void optimizeIndex()
Calls optimize on the relevant index (useful periodically to increase response times on the free-text search)



Copyright © 2007-2013 EDIT. All Rights Reserved.