org.hibernate.search.query.dsl
Interface QueryContextBuilder

All Known Implementing Classes:
ConnectedQueryContextBuilder

public interface QueryContextBuilder

Query builder that needs contextualization: A query builder should know which entity or analyzer it relies on. QueryBuilder builder = searchFactory.buildQueryBuilder() .forEntity(Customer.class) .overridesForField("profession", "acronym-analyzer") .get(); overridesForField is optional (and usually not needed). This method overrides the underlying analyzer (for a given field) used to build queries.

Author:
Emmanuel Bernard

Method Summary
 EntityContext forEntity(Class<?> entityType)
          Creates an entity context which can be used to obtain a QueryBuilder.
 

Method Detail

forEntity

EntityContext forEntity(Class<?> entityType)
Creates an entity context which can be used to obtain a QueryBuilder.

Note that the passed entity type is used to verify field names, transparently apply analyzers and field bridges etc. The query result list, however, is not automatically restricted to the given type. Instead a type filter must be applied when creating the full text query in order to restrict the query result to certain entity types.

Parameters:
entityType - entity type used for meta data retrieval during query creation
Returns:
an entity context


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