Package com.adobe.acs.commons.search
Interface CloseableQueryBuilder
-
@ProviderType public interface CloseableQueryBuilderA drop-in replacement for the CQ QueryBuilder service that wrapsQueryinstances to produceCloseableQueryinstances, whoseCloseableQuery.close()method cleans up the internal shallow resource resolver.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclearFacetCache()Clears the QueryBuilder facet cache, in case you need to do that.CloseableQuerycreateQuery(com.day.cq.search.PredicateGroup predicates, javax.jcr.Session session)Create a closeable query around the provided predicate group.CloseableQuerycreateQuery(com.day.cq.search.PredicateGroup predicates, org.apache.sling.api.resource.ResourceResolver resourceResolver)Create a closeable query around the provided predicate group.CloseableQuerycreateQuery(javax.jcr.Session session)Create a closeable query.CloseableQuerycreateQuery(org.apache.sling.api.resource.ResourceResolver resourceResolver)Create a closeable query.CloseableQueryloadQuery(String path, javax.jcr.Session session)Load a CQ Search query from a properties file located at the specified path.CloseableQueryloadQuery(String path, org.apache.sling.api.resource.ResourceResolver resourceResolver)Load a CQ Search query from a properties file located at the specified path.voidstoreQuery(com.day.cq.search.Query query, String path, boolean createFile, javax.jcr.Session session)Saves the query predicates to a properties file in the repository at the specified path.voidstoreQuery(com.day.cq.search.Query query, String path, boolean createFile, org.apache.sling.api.resource.ResourceResolver resourceResolver)Saves the query predicates to a properties file in the repository at the specified path.
-
-
-
Method Detail
-
createQuery
CloseableQuery createQuery(com.day.cq.search.PredicateGroup predicates, org.apache.sling.api.resource.ResourceResolver resourceResolver)
Create a closeable query around the provided predicate group.- Parameters:
predicates- the root group of predicatesresourceResolver- the session to use- Returns:
- a closeable query
-
createQuery
CloseableQuery createQuery(org.apache.sling.api.resource.ResourceResolver resourceResolver)
Create a closeable query.- Parameters:
resourceResolver- the session to use- Returns:
- a closeable query
-
createQuery
CloseableQuery createQuery(com.day.cq.search.PredicateGroup predicates, javax.jcr.Session session)
Create a closeable query around the provided predicate group.- Parameters:
predicates- the root group of predicatessession- the session to use- Returns:
- a closeable query
-
createQuery
CloseableQuery createQuery(javax.jcr.Session session)
Create a closeable query.- Parameters:
session- the session to use- Returns:
- a closeable query
-
loadQuery
CloseableQuery loadQuery(String path, org.apache.sling.api.resource.ResourceResolver resourceResolver) throws javax.jcr.RepositoryException, IOException
Load a CQ Search query from a properties file located at the specified path. If the specified path does not exist, returns null.- Parameters:
path- a repository path to a properties fileresourceResolver- the resource resolver providing access to the repository- Returns:
- a query ready for execution
- Throws:
javax.jcr.RepositoryException- on JCR failureIOException- on failure to read properties file
-
loadQuery
CloseableQuery loadQuery(String path, javax.jcr.Session session) throws javax.jcr.RepositoryException, IOException
Load a CQ Search query from a properties file located at the specified path. If the specified path does not exist, returns null.- Parameters:
path- a repository path to a properties filesession- the session providing access to the repository- Returns:
- a query ready for execution
- Throws:
javax.jcr.RepositoryException- on JCR failureIOException- on failure to read properties file
-
storeQuery
void storeQuery(com.day.cq.search.Query query, String path, boolean createFile, org.apache.sling.api.resource.ResourceResolver resourceResolver) throws javax.jcr.RepositoryException, IOExceptionSaves the query predicates to a properties file in the repository at the specified path.- Parameters:
query- the query whose predicates should be storedpath- the path of the properties filecreateFile- true to create the file if it doesn't exist alreadyresourceResolver- the session to use- Throws:
javax.jcr.RepositoryException- on JCR failureIOException- on failure save properties file
-
storeQuery
void storeQuery(com.day.cq.search.Query query, String path, boolean createFile, javax.jcr.Session session) throws javax.jcr.RepositoryException, IOExceptionSaves the query predicates to a properties file in the repository at the specified path.- Parameters:
query- the query whose predicates should be storedpath- the path of the properties filecreateFile- true to create the file if it doesn't exist alreadysession- the session to use- Throws:
javax.jcr.RepositoryException- on JCR failureIOException- on failure save properties file
-
clearFacetCache
void clearFacetCache()
Clears the QueryBuilder facet cache, in case you need to do that.
-
-