org.hibernate.search.sandbox.standalone
Class LuceneFullTextManager

java.lang.Object
  extended by org.hibernate.search.sandbox.standalone.LuceneFullTextManager
All Implemented Interfaces:
FullTextManager

public class LuceneFullTextManager
extends Object
implements FullTextManager

Implements a standalone full text service. Data is stored in Lucene

Author:
Emmanuel Bernard

Method Summary
 FullTextQuery createFullTextQuery(org.apache.lucene.search.Query luceneQuery, Class<?>... entities)
          Create a fulltext query on top of a native Lucene query returning the matching objects of type entities and their respective subclasses.
 void flushToIndexes()
          Flush all index changes forcing Hibernate Search to apply all changes to the index not waiting for the batch limit.
<T> T
get(Class<T> entityType, Serializable id)
          Returns the entity instance of a given type and id value
 SearchFactory getSearchFactory()
           
<T> void
index(T entity)
          (Re-)index an entity.
<T> void
purge(Class<T> entityType, Serializable id)
          Remove the entity with the type entityType and the identifier id from the index.
<T> void
purgeAll(Class<T> entityType)
          Remove all entities from of particular class and all its subclasses from the index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get

public <T> T get(Class<T> entityType,
                 Serializable id)
Description copied from interface: FullTextManager
Returns the entity instance of a given type and id value

Specified by:
get in interface FullTextManager

createFullTextQuery

public FullTextQuery createFullTextQuery(org.apache.lucene.search.Query luceneQuery,
                                         Class<?>... entities)
Description copied from interface: FullTextManager
Create a fulltext query on top of a native Lucene query returning the matching objects of type entities and their respective subclasses.

Specified by:
createFullTextQuery in interface FullTextManager
Parameters:
luceneQuery - The native Lucene query to be rn against the Lucene index.
entities - List of classes for type filtering. The query result will only return entities of the specified types and their respective subtype. If no class is specified no type filtering will take place.
Returns:
A FullTextQuery wrapping around the native Lucene query.

index

public <T> void index(T entity)
(Re-)index an entity. The entity must be associated with the session and non indexable entities are ignored.

Specified by:
index in interface FullTextManager
Parameters:
entity - The entity to index - must not be null.
Throws:
IllegalArgumentException - if entity is null or not an @Indexed entity

getSearchFactory

public SearchFactory getSearchFactory()
Specified by:
getSearchFactory in interface FullTextManager
Returns:
the SearchFactory instance.

purge

public <T> void purge(Class<T> entityType,
                      Serializable id)
Description copied from interface: FullTextManager
Remove the entity with the type entityType and the identifier id from the index. If id == null all indexed entities of this type and its indexed subclasses are deleted. In this case this method behaves like FullTextManager.purgeAll(Class).

Specified by:
purge in interface FullTextManager
Parameters:
entityType - The type of the entity to delete.
id - The id of the entity to delete.

purgeAll

public <T> void purgeAll(Class<T> entityType)
Description copied from interface: FullTextManager
Remove all entities from of particular class and all its subclasses from the index.

Specified by:
purgeAll in interface FullTextManager
Parameters:
entityType - The class of the entities to remove.

flushToIndexes

public void flushToIndexes()
Description copied from interface: FullTextManager
Flush all index changes forcing Hibernate Search to apply all changes to the index not waiting for the batch limit.

Specified by:
flushToIndexes in interface FullTextManager


Copyright © 2006-2012 Red Hat Middleware, LLC. All Rights Reserved