[hibernate-commits] Hibernate SVN: r18816 - in search/trunk/src/main/java/org/hibernate/search: impl and 2 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Wed Feb 17 06:18:24 EST 2010


Author: epbernard
Date: 2010-02-17 06:18:23 -0500 (Wed, 17 Feb 2010)
New Revision: 18816

Modified:
   search/trunk/src/main/java/org/hibernate/search/FullTextQuery.java
   search/trunk/src/main/java/org/hibernate/search/impl/FullTextSessionImpl.java
   search/trunk/src/main/java/org/hibernate/search/jpa/impl/FullTextEntityManagerImpl.java
   search/trunk/src/main/java/org/hibernate/search/jpa/impl/FullTextQueryImpl.java
   search/trunk/src/main/java/org/hibernate/search/query/FullTextQueryImpl.java
Log:
HSEARCH-422 various improvements.

Modified: search/trunk/src/main/java/org/hibernate/search/FullTextQuery.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/FullTextQuery.java	2010-02-16 22:19:53 UTC (rev 18815)
+++ search/trunk/src/main/java/org/hibernate/search/FullTextQuery.java	2010-02-17 11:18:23 UTC (rev 18816)
@@ -27,6 +27,7 @@
 import org.apache.lucene.search.Filter;
 import org.apache.lucene.search.Sort;
 import org.apache.lucene.search.Explanation;
+
 import org.hibernate.Criteria;
 import org.hibernate.Query;
 import org.hibernate.transform.ResultTransformer;
@@ -47,6 +48,7 @@
 	 * order the hibernate objects.
 	 *
 	 * @param sort The lucene sort object.
+	 *
 	 * @return this for method chaining
 	 */
 	FullTextQuery setSort(Sort sort);
@@ -56,6 +58,7 @@
 	 * Semi-deprecated? a preferred way is to use the @FullTextFilterDef approach
 	 *
 	 * @param filter The lucene filter.
+	 *
 	 * @return this for method chaining
 	 */
 	FullTextQuery setFilter(Filter filter);
@@ -107,6 +110,7 @@
 	 * in the current query
 	 *
 	 * @param documentId Lucene Document id to be explain. This is NOT the object id
+	 *
 	 * @return Lucene Explanation
 	 */
 	Explanation explain(int documentId);
@@ -131,9 +135,9 @@
 	 */
 	FullTextQuery setResultTransformer(ResultTransformer transformer);
 
-    /**
-     * return the underlying type if possible
-     * TODO document what can be unwrapped
-     */
-    <T> T unwrap(Class<T> type);
+	/**
+	 * return the underlying type if possible
+	 * TODO document what can be unwrapped
+	 */
+	<T> T unwrap(Class<T> type);
 }

Modified: search/trunk/src/main/java/org/hibernate/search/impl/FullTextSessionImpl.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/impl/FullTextSessionImpl.java	2010-02-16 22:19:53 UTC (rev 18815)
+++ search/trunk/src/main/java/org/hibernate/search/impl/FullTextSessionImpl.java	2010-02-17 11:18:23 UTC (rev 18816)
@@ -89,7 +89,7 @@
  * @author John Griffin
  * @author Hardy Ferentschik
  */
- at SuppressWarnings( "deprecation" )
+ at SuppressWarnings("deprecation")
 public class FullTextSessionImpl implements FullTextSession, SessionImplementor {
 
 	private final Session session;
@@ -134,7 +134,11 @@
 			return;
 		}
 
-		Set<Class<?>> targetedClasses = getSearchFactoryImplementor().getIndexedTypesPolymorphic( new Class[] {entityType} );
+		Set<Class<?>> targetedClasses = getSearchFactoryImplementor().getIndexedTypesPolymorphic(
+				new Class[] {
+						entityType
+				}
+		);
 		if ( targetedClasses.isEmpty() ) {
 			String msg = entityType.getName() + " is not an indexed entity or a subclass of an indexed entity";
 			throw new IllegalArgumentException( msg );
@@ -189,7 +193,7 @@
 		//another solution would be to subclass SessionImpl instead of having this LuceneSession delegation model
 		//this is an open discussion
 	}
-	
+
 	public MassIndexer createIndexer(Class<?>... types) {
 		if ( types.length == 0 ) {
 			return new MassIndexerImpl( getSearchFactoryImplementor(), getSessionFactory(), Object.class );
@@ -389,7 +393,7 @@
 	}
 
 	public Object get(Class clazz, Serializable id, LockOptions lockOptions) throws HibernateException {
-		return session.get(clazz, id, lockOptions);
+		return session.get( clazz, id, lockOptions );
 	}
 
 	public Object get(String entityName, Serializable id) throws HibernateException {
@@ -401,7 +405,7 @@
 	}
 
 	public Object get(String entityName, Serializable id, LockOptions lockOptions) throws HibernateException {
-		return session.get(entityName, id, lockOptions);
+		return session.get( entityName, id, lockOptions );
 	}
 
 	public CacheMode getCacheMode() {
@@ -654,9 +658,9 @@
 		return session.isDirty();
 	}
 
-    public boolean isDefaultReadOnly() {
-        return session.isDefaultReadOnly();
-    }
+	public boolean isDefaultReadOnly() {
+		return session.isDefaultReadOnly();
+	}
 
 	public boolean isOpen() {
 		return session.isOpen();
@@ -766,9 +770,9 @@
 		session.setCacheMode( cacheMode );
 	}
 
-    public void setDefaultReadOnly(boolean readOnly) {
-        session.setDefaultReadOnly( readOnly );
-    }
+	public void setDefaultReadOnly(boolean readOnly) {
+		session.setDefaultReadOnly( readOnly );
+	}
 
 	public void setFlushMode(FlushMode flushMode) {
 		session.setFlushMode( flushMode );

Modified: search/trunk/src/main/java/org/hibernate/search/jpa/impl/FullTextEntityManagerImpl.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/jpa/impl/FullTextEntityManagerImpl.java	2010-02-16 22:19:53 UTC (rev 18815)
+++ search/trunk/src/main/java/org/hibernate/search/jpa/impl/FullTextEntityManagerImpl.java	2010-02-17 11:18:23 UTC (rev 18816)
@@ -136,15 +136,15 @@
 	}
 
 	public <T> T find(Class<T> entityClass, Object primaryKey, Map<String, Object> hints) {
-		return em.find(entityClass, primaryKey, hints);
+		return em.find( entityClass, primaryKey, hints );
 	}
 
 	public <T> T find(Class<T> entityClass, Object primaryKey, LockModeType lockModeType) {
-		return em.find(entityClass, primaryKey, lockModeType);
+		return em.find( entityClass, primaryKey, lockModeType );
 	}
 
 	public <T> T find(Class<T> entityClass, Object primaryKey, LockModeType lockModeType, Map<String, Object> hints) {
-		return em.find(entityClass, primaryKey, lockModeType, hints);
+		return em.find( entityClass, primaryKey, lockModeType, hints );
 	}
 
 	public <T> T getReference(Class<T> entityClass, Object primaryKey) {
@@ -168,7 +168,7 @@
 	}
 
 	public void lock(Object entity, LockModeType lockModeType, Map<String, Object> hints) {
-		em.lock(entity, lockModeType, hints);
+		em.lock( entity, lockModeType, hints );
 	}
 
 	public void refresh(Object entity) {
@@ -176,15 +176,15 @@
 	}
 
 	public void refresh(Object entity, Map<String, Object> hints) {
-		em.refresh(entity, hints);
+		em.refresh( entity, hints );
 	}
 
 	public void refresh(Object entity, LockModeType lockModeType) {
-		em.refresh(entity, lockModeType);
+		em.refresh( entity, lockModeType );
 	}
 
 	public void refresh(Object entity, LockModeType lockModeType, Map<String, Object> hints) {
-		em.refresh(entity, lockModeType, hints);
+		em.refresh( entity, lockModeType, hints );
 	}
 
 	public void clear() {
@@ -192,7 +192,7 @@
 	}
 
 	public void detach(Object entity) {
-		em.detach(entity);
+		em.detach( entity );
 	}
 
 	public boolean contains(Object entity) {
@@ -200,11 +200,11 @@
 	}
 
 	public LockModeType getLockMode(Object entity) {
-		return em.getLockMode(entity);
+		return em.getLockMode( entity );
 	}
 
 	public void setProperty(String key, Object value) {
-		em.setProperty(key, value);
+		em.setProperty( key, value );
 	}
 
 	public Map<String, Object> getProperties() {
@@ -248,14 +248,14 @@
 	}
 
 	public <T> T unwrap(Class<T> type) {
-        if (type.equals( FullTextSession.class ) ) {
-            @SuppressWarnings("unchecked")
-            final T ftSession = (T) Search.getFullTextSession(em.unwrap(Session.class));
-            return ftSession;
-        }
-        else {
-		    return em.unwrap(type);
-        }
+		if ( type.equals( FullTextSession.class ) ) {
+			@SuppressWarnings("unchecked")
+			final T ftSession = ( T ) Search.getFullTextSession( em.unwrap( Session.class ) );
+			return ftSession;
+		}
+		else {
+			return em.unwrap( type );
+		}
 	}
 
 	public Object getDelegate() {
@@ -289,5 +289,5 @@
 	public MassIndexer createIndexer(Class<?>... types) {
 		return getFullTextSession().createIndexer( types );
 	}
-	
+
 }

Modified: search/trunk/src/main/java/org/hibernate/search/jpa/impl/FullTextQueryImpl.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/jpa/impl/FullTextQueryImpl.java	2010-02-16 22:19:53 UTC (rev 18815)
+++ search/trunk/src/main/java/org/hibernate/search/jpa/impl/FullTextQueryImpl.java	2010-02-17 11:18:23 UTC (rev 18816)
@@ -41,6 +41,7 @@
 import org.apache.lucene.search.Filter;
 import org.apache.lucene.search.Sort;
 import org.apache.lucene.search.Explanation;
+
 import org.hibernate.Criteria;
 import org.hibernate.FlushMode;
 import org.hibernate.HibernateException;
@@ -63,18 +64,19 @@
  * Implements JPA 2 query interface and delegate the call to
  * a Hibernate Core FullTextQuery.
  * This has the consequence of "duplicating" the JPA 2 query logic in some areas.
+ *
  * @author Emmanuel Bernard
  */
 public class FullTextQueryImpl implements FullTextQuery {
 	private final org.hibernate.search.FullTextQuery query;
 	private final Session session;
-    private Integer firstResult;
+	private Integer firstResult;
 	private Integer maxResults;
-    //initialized at 0 since we don't expect to use hints at this stage
-    private final Map<String, Object> hints = new HashMap<String, Object>(0);
-    private FlushModeType jpaFlushMode;
+	//initialized at 0 since we don't expect to use hints at this stage
+	private final Map<String, Object> hints = new HashMap<String, Object>( 0 );
+	private FlushModeType jpaFlushMode;
 
-    public FullTextQueryImpl(org.hibernate.search.FullTextQuery query, Session session) {
+	public FullTextQueryImpl(org.hibernate.search.FullTextQuery query, Session session) {
 		this.query = query;
 		this.session = session;
 	}
@@ -120,25 +122,26 @@
 		try {
 			return query.list();
 		}
-		catch (QueryExecutionRequestException he) {
+		catch ( QueryExecutionRequestException he ) {
 			//TODO when an illegal state exception should be raised?
-			throw new IllegalStateException(he);
+			throw new IllegalStateException( he );
 		}
-		catch( TypeMismatchException e ) {
+		catch ( TypeMismatchException e ) {
 			//TODO when an illegal arg exception should be raised?
-			throw new IllegalArgumentException(e);
+			throw new IllegalArgumentException( e );
 		}
-		catch (SearchException he) {
+		catch ( SearchException he ) {
 			throwPersistenceException( he );
 			throw he;
 		}
 	}
 
 	//TODO mutualize this code with the EM this will fix the rollback issues
-	@SuppressWarnings( { "ThrowableInstanceNeverThrown" } )
+
+	@SuppressWarnings({ "ThrowableInstanceNeverThrown" })
 	private void throwPersistenceException(Exception e) {
 		if ( e instanceof StaleStateException ) {
-			PersistenceException pe = wrapStaleStateException( (StaleStateException) e );
+			PersistenceException pe = wrapStaleStateException( ( StaleStateException ) e );
 			throwPersistenceException( pe );
 		}
 		else if ( e instanceof ConstraintViolationException ) {
@@ -167,19 +170,19 @@
 	}
 
 	void throwPersistenceException(PersistenceException e) {
-		if ( ! ( e instanceof NoResultException || e instanceof NonUniqueResultException ) ) {
+		if ( !( e instanceof NoResultException || e instanceof NonUniqueResultException ) ) {
 			//FIXME rollback
 		}
 		throw e;
 	}
 
-	@SuppressWarnings( { "ThrowableInstanceNeverThrown" } )
+	@SuppressWarnings({ "ThrowableInstanceNeverThrown" })
 	PersistenceException wrapStaleStateException(StaleStateException e) {
 		PersistenceException pe;
 		if ( e instanceof StaleObjectStateException ) {
-			StaleObjectStateException sose = (StaleObjectStateException) e;
+			StaleObjectStateException sose = ( StaleObjectStateException ) e;
 			Serializable identifier = sose.getIdentifier();
-			if (identifier != null) {
+			if ( identifier != null ) {
 				Object entity = session.load( sose.getEntityName(), identifier );
 				if ( entity instanceof Serializable ) {
 					//avoid some user errors regarding boundary crossing
@@ -199,7 +202,7 @@
 		return pe;
 	}
 
-	@SuppressWarnings( { "ThrowableInstanceNeverThrown" } )
+	@SuppressWarnings({ "ThrowableInstanceNeverThrown" })
 	public Object getSingleResult() {
 		try {
 			List result = query.list();
@@ -207,9 +210,9 @@
 				throwPersistenceException( new NoResultException( "No entity found for query" ) );
 			}
 			else if ( result.size() > 1 ) {
-				Set uniqueResult = new HashSet(result);
+				Set uniqueResult = new HashSet( result );
 				if ( uniqueResult.size() > 1 ) {
-					throwPersistenceException( new NonUniqueResultException( "result returns " + uniqueResult.size() + " elements") );
+					throwPersistenceException( new NonUniqueResultException( "result returns " + uniqueResult.size() + " elements" ) );
 				}
 				else {
 					return uniqueResult.iterator().next();
@@ -217,17 +220,17 @@
 
 			}
 			else {
-				return result.get(0);
+				return result.get( 0 );
 			}
 			return null; //should never happen
 		}
-		catch (QueryExecutionRequestException he) {
-			throw new IllegalStateException(he);
+		catch ( QueryExecutionRequestException he ) {
+			throw new IllegalStateException( he );
 		}
-		catch( TypeMismatchException e ) {
-			throw new IllegalArgumentException(e);
+		catch ( TypeMismatchException e ) {
+			throw new IllegalArgumentException( e );
 		}
-		catch (HibernateException he) {
+		catch ( HibernateException he ) {
 			throwPersistenceException( he );
 			return null;
 		}
@@ -242,12 +245,12 @@
 			);
 		}
 		query.setMaxResults( maxResults );
-        this.maxResults = maxResults;
+		this.maxResults = maxResults;
 		return this;
 	}
 
 	public int getMaxResults() {
-        return maxResults == null || maxResults == -1
+		return maxResults == null || maxResults == -1
 				? Integer.MAX_VALUE
 				: maxResults;
 	}
@@ -261,7 +264,7 @@
 			);
 		}
 		query.setFirstResult( firstResult );
-        this.firstResult = firstResult;
+		this.firstResult = firstResult;
 		return this;
 	}
 
@@ -278,7 +281,7 @@
 	}
 
 	public Query setHint(String hintName, Object value) {
-        hints.put(hintName, value);
+		hints.put( hintName, value );
 		return this;
 	}
 
@@ -287,79 +290,79 @@
 	}
 
 	public <T> Query setParameter(Parameter<T> tParameter, T t) {
-		throw new UnsupportedOperationException( "parameters not supported in fullText queries");
+		throw new UnsupportedOperationException( "parameters not supported in fullText queries" );
 	}
 
 	public Query setParameter(Parameter<Calendar> calendarParameter, Calendar calendar, TemporalType temporalType) {
-		throw new UnsupportedOperationException( "parameters not supported in fullText queries");
+		throw new UnsupportedOperationException( "parameters not supported in fullText queries" );
 	}
 
 	public Query setParameter(Parameter<Date> dateParameter, Date date, TemporalType temporalType) {
-		throw new UnsupportedOperationException( "parameters not supported in fullText queries");
+		throw new UnsupportedOperationException( "parameters not supported in fullText queries" );
 	}
 
 	public Query setParameter(String name, Object value) {
-		throw new UnsupportedOperationException( "parameters not supported in fullText queries");
+		throw new UnsupportedOperationException( "parameters not supported in fullText queries" );
 	}
 
 	public Query setParameter(String name, Date value, TemporalType temporalType) {
-		throw new UnsupportedOperationException( "parameters not supported in fullText queries");
+		throw new UnsupportedOperationException( "parameters not supported in fullText queries" );
 	}
 
 	public Query setParameter(String name, Calendar value, TemporalType temporalType) {
-		throw new UnsupportedOperationException( "parameters not supported in fullText queries");
+		throw new UnsupportedOperationException( "parameters not supported in fullText queries" );
 	}
 
 	public Query setParameter(int position, Object value) {
-		throw new UnsupportedOperationException( "parameters not supported in fullText queries");
+		throw new UnsupportedOperationException( "parameters not supported in fullText queries" );
 	}
 
 	public Query setParameter(int position, Date value, TemporalType temporalType) {
-		throw new UnsupportedOperationException( "parameters not supported in fullText queries");
+		throw new UnsupportedOperationException( "parameters not supported in fullText queries" );
 	}
 
-    public Set<Parameter<?>> getParameters() {
-        return Collections.EMPTY_SET;
-    }
+	public Set<Parameter<?>> getParameters() {
+		return Collections.EMPTY_SET;
+	}
 
-    public Query setParameter(int position, Calendar value, TemporalType temporalType) {
-		throw new UnsupportedOperationException( "parameters not supported in fullText queries");
+	public Query setParameter(int position, Calendar value, TemporalType temporalType) {
+		throw new UnsupportedOperationException( "parameters not supported in fullText queries" );
 	}
 
 	public Parameter<?> getParameter(String name) {
-		throw new UnsupportedOperationException( "parameters not supported in fullText queries");
+		throw new UnsupportedOperationException( "parameters not supported in fullText queries" );
 	}
 
 	public Parameter<?> getParameter(int position) {
-		throw new UnsupportedOperationException( "parameters not supported in fullText queries");
+		throw new UnsupportedOperationException( "parameters not supported in fullText queries" );
 	}
 
 	public <T> Parameter<T> getParameter(String name, Class<T> type) {
-		throw new UnsupportedOperationException( "parameters not supported in fullText queries");
+		throw new UnsupportedOperationException( "parameters not supported in fullText queries" );
 	}
 
 	public <T> Parameter<T> getParameter(int position, Class<T> type) {
-		throw new UnsupportedOperationException( "parameters not supported in fullText queries");
+		throw new UnsupportedOperationException( "parameters not supported in fullText queries" );
 	}
 
 	public boolean isBound(Parameter<?> param) {
-		throw new UnsupportedOperationException( "parameters not supported in fullText queries");
+		throw new UnsupportedOperationException( "parameters not supported in fullText queries" );
 	}
 
 	public <T> T getParameterValue(Parameter<T> param) {
-		throw new UnsupportedOperationException( "parameters not supported in fullText queries");
+		throw new UnsupportedOperationException( "parameters not supported in fullText queries" );
 	}
 
 	public Object getParameterValue(String name) {
-		throw new UnsupportedOperationException( "parameters not supported in fullText queries");
+		throw new UnsupportedOperationException( "parameters not supported in fullText queries" );
 	}
 
 	public Object getParameterValue(int position) {
-		throw new UnsupportedOperationException( "parameters not supported in fullText queries");
+		throw new UnsupportedOperationException( "parameters not supported in fullText queries" );
 	}
 
 	public Query setFlushMode(FlushModeType flushMode) {
-        this.jpaFlushMode = flushMode;
+		this.jpaFlushMode = flushMode;
 		if ( flushMode == FlushModeType.AUTO ) {
 			query.setFlushMode( FlushMode.AUTO );
 		}
@@ -370,35 +373,32 @@
 	}
 
 	public FlushModeType getFlushMode() {
-        if (jpaFlushMode != null) {
-            return jpaFlushMode;
-        }
-        final FlushMode hibernateFlushMode = session.getFlushMode();
-        if (FlushMode.AUTO == hibernateFlushMode) {
-            return FlushModeType.AUTO;
-        }
-        else if (FlushMode.COMMIT == hibernateFlushMode) {
-            return FlushModeType.COMMIT;
-        }
-        else {
-            return null; //incompatible flush mode
-        }
+		if ( jpaFlushMode != null ) {
+			return jpaFlushMode;
+		}
+		final FlushMode hibernateFlushMode = session.getFlushMode();
+		if ( FlushMode.AUTO == hibernateFlushMode ) {
+			return FlushModeType.AUTO;
+		}
+		else if ( FlushMode.COMMIT == hibernateFlushMode ) {
+			return FlushModeType.COMMIT;
+		}
+		else {
+			return null; //incompatible flush mode
+		}
 	}
 
 	public Query setLockMode(LockModeType lockModeType) {
-		throw new UnsupportedOperationException( "lock modes not supported in fullText queries");
+		throw new UnsupportedOperationException( "lock modes not supported in fullText queries" );
 	}
 
 	public LockModeType getLockMode() {
-		throw new UnsupportedOperationException( "lock modes not supported in fullText queries");
+		throw new UnsupportedOperationException( "lock modes not supported in fullText queries" );
 	}
 
 	public <T> T unwrap(Class<T> type) {
-		if ( type.equals( org.hibernate.search.FullTextQuery.class ) ) {
-            return (T) query;
-        }
-        else {
-            return query.unwrap( type );
-        }
+		//I've purposely decided not to return the underlying Hibernate FullTextQuery
+		//as I see this as an implementation detail that should not be exposed.
+		return query.unwrap( type );
 	}
 }

Modified: search/trunk/src/main/java/org/hibernate/search/query/FullTextQueryImpl.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/query/FullTextQueryImpl.java	2010-02-16 22:19:53 UTC (rev 18815)
+++ search/trunk/src/main/java/org/hibernate/search/query/FullTextQueryImpl.java	2010-02-17 11:18:23 UTC (rev 18816)
@@ -81,12 +81,16 @@
 import org.hibernate.search.filter.FullTextFilterImplementor;
 import org.hibernate.search.filter.ShardSensitiveOnlyFilter;
 import org.hibernate.search.reader.ReaderProvider;
+
 import static org.hibernate.search.reader.ReaderProviderHelper.getIndexReaders;
+
 import org.hibernate.search.store.DirectoryProvider;
 import org.hibernate.search.store.IndexShardingStrategy;
 import org.hibernate.search.util.ContextHelper;
+
 import static org.hibernate.search.util.FilterCacheModeTypeHelper.cacheInstance;
 import static org.hibernate.search.util.FilterCacheModeTypeHelper.cacheResults;
+
 import org.hibernate.search.util.LoggerFactory;
 import org.hibernate.transform.ResultTransformer;
 import org.hibernate.util.ReflectHelper;
@@ -430,17 +434,21 @@
 
 	private void buildFilters() {
 		ChainedFilter chainedFilter = null;
-		if ( ! filterDefinitions.isEmpty() ) {
+		if ( !filterDefinitions.isEmpty() ) {
 			chainedFilter = new ChainedFilter();
 			for ( FullTextFilterImpl fullTextFilter : filterDefinitions.values() ) {
 				Filter filter = buildLuceneFilter( fullTextFilter );
-				if (filter != null) chainedFilter.addFilter( filter );
+				if ( filter != null ) {
+					chainedFilter.addFilter( filter );
+				}
 			}
 		}
 
 		if ( userFilter != null ) {
 			//chainedFilter is not always necessary here but the code is easier to read
-			if (chainedFilter == null) chainedFilter = new ChainedFilter();
+			if ( chainedFilter == null ) {
+				chainedFilter = new ChainedFilter();
+			}
 			chainedFilter.addFilter( userFilter );
 		}
 
@@ -469,7 +477,9 @@
 		FilterDef def = searchFactoryImplementor.getFilterDefinition( fullTextFilter.getName() );
 		//def can never be null, ti's guarded by enableFullTextFilter(String)
 
-		if ( isPreQueryFilterOnly(def) ) return null;
+		if ( isPreQueryFilterOnly( def ) ) {
+			return null;
+		}
 
 		Object instance = createFilterInstance( fullTextFilter, def );
 		FilterKey key = createFilterKey( def, instance );
@@ -753,7 +763,9 @@
 		}
 
 		//set up the searcher
-		final DirectoryProvider[] directoryProviders = targetedDirectories.toArray( new DirectoryProvider[targetedDirectories.size()] );
+		final DirectoryProvider[] directoryProviders = targetedDirectories.toArray(
+				new DirectoryProvider[targetedDirectories.size()]
+		);
 		IndexSearcher is = new IndexSearcher(
 				searchFactoryImplementor.getReaderProvider().openReader(
 						directoryProviders
@@ -768,14 +780,14 @@
 		final DirectoryProvider[] directoryProviders;
 		if ( filterDefinitions != null && !filterDefinitions.isEmpty() ) {
 			directoryProviders = indexShardingStrategy.getDirectoryProvidersForQuery(
-				filterDefinitions.values().toArray( new FullTextFilterImplementor[filterDefinitions.size()] )
+					filterDefinitions.values().toArray( new FullTextFilterImplementor[filterDefinitions.size()] )
 			);
 		}
 		else {
 			//no filter get all shards
 			directoryProviders = indexShardingStrategy.getDirectoryProvidersForQuery( EMPTY_FULL_TEXT_FILTER_IMPLEMENTOR );
 		}
-		
+
 		for ( DirectoryProvider provider : directoryProviders ) {
 			if ( !directories.contains( provider ) ) {
 				directories.add( provider );
@@ -879,7 +891,7 @@
 	}
 
 	public Query setLockOptions(LockOptions lockOptions) {
-		throw new UnsupportedOperationException( "Lock options are not implemented in Hibernate Search queries");
+		throw new UnsupportedOperationException( "Lock options are not implemented in Hibernate Search queries" );
 	}
 
 	@Override
@@ -889,11 +901,11 @@
 		return this;
 	}
 
-    public <T> T unwrap(Class<T> type) {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
+	public <T> T unwrap(Class<T> type) {
+		return null;  //To change body of implemented methods use File | Settings | File Templates.
+	}
 
-    protected LockOptions getLockOptions() {
+	protected LockOptions getLockOptions() {
 		return null;
 	}
 



More information about the hibernate-commits mailing list