Package org.imixs.workflow.engine.lucene
Class LuceneSearchService
- java.lang.Object
-
- org.imixs.workflow.engine.lucene.LuceneSearchService
-
- All Implemented Interfaces:
SearchService
@DeclareRoles({"org.imixs.ACCESSLEVEL.NOACCESS","org.imixs.ACCESSLEVEL.READERACCESS","org.imixs.ACCESSLEVEL.AUTHORACCESS","org.imixs.ACCESSLEVEL.EDITORACCESS","org.imixs.ACCESSLEVEL.MANAGERACCESS"}) @RolesAllowed({"org.imixs.ACCESSLEVEL.NOACCESS","org.imixs.ACCESSLEVEL.READERACCESS","org.imixs.ACCESSLEVEL.AUTHORACCESS","org.imixs.ACCESSLEVEL.EDITORACCESS","org.imixs.ACCESSLEVEL.MANAGERACCESS"}) public class LuceneSearchService extends Object implements SearchServiceThis session ejb provides a service to search the lucene index. The EJB uses the IndexSearcher to query the current index. As the index can change across multiple searches we can not share a single IndexSearcher instance. For that reason the EJB is creating a new IndexSearch per-search. The service provides a set of public methods which can be used to query workitems or collections of workitems. A search term can be escaped by calling the methodescpeSearchTerm. This method prepends a\for those characters that QueryParser expects to be escaped.- Version:
- 2.0
- Author:
- rsoika
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_MAX_SEARCH_RESULTstatic intDEFAULT_PAGE_SIZE
-
Constructor Summary
Constructors Constructor Description LuceneSearchService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Category>getTaxonomy(String... categories)List<Category>getTaxonomyByQuery(String searchTerm, String... categories)intgetTotalHits(String _searchTerm, int _maxResult, DefaultOperator defaultOperator)Returns the total hits for a given search term from the lucene index.List<ItemCollection>search(String searchTerm, int pageSize, int pageIndex, SortOrder sortOrder, DefaultOperator defaultOperator, boolean loadStubs)Returns a collection of documents matching the provided search term.
-
-
-
Field Detail
-
DEFAULT_MAX_SEARCH_RESULT
public static final int DEFAULT_MAX_SEARCH_RESULT
- See Also:
- Constant Field Values
-
DEFAULT_PAGE_SIZE
public static final int DEFAULT_PAGE_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
search
public List<ItemCollection> search(String searchTerm, int pageSize, int pageIndex, SortOrder sortOrder, DefaultOperator defaultOperator, boolean loadStubs) throws QueryException
Returns a collection of documents matching the provided search term. The term will be extended with the current users roles to test the read access level of each workitem matching the search term.The optional param 'searchOrder' can be set to force lucene to sort the search result by any search order.
The optional param 'defaultOperator' can be set to Operator.AND
The optional param 'stubs' indicates if the full Imixs Document should be loaded or if only the data fields stored in the lucedn index will be return. The later is the faster method but returns only document stubs.
- Specified by:
searchin interfaceSearchService- Parameters:
searchTerm-pageSize- - docs per pagepageIndex- - page numbersortOrder-defaultOperator- - optional to change the default search operatorloadStubs- - optional indicates of only the lucene document should be returned.- Returns:
- collection of search result
- Throws:
QueryException- in case the searchtem is not understandable.
-
getTaxonomy
public List<Category> getTaxonomy(String... categories)
- Specified by:
getTaxonomyin interfaceSearchService
-
getTaxonomyByQuery
public List<Category> getTaxonomyByQuery(String searchTerm, String... categories)
- Specified by:
getTaxonomyByQueryin interfaceSearchService
-
getTotalHits
public int getTotalHits(String _searchTerm, int _maxResult, DefaultOperator defaultOperator) throws QueryException
Returns the total hits for a given search term from the lucene index. The method did not load any data. The provided search term will we extended with a users roles to test the read access level of each workitem matching the search term. The optional param 'maxResult' can be set to overwrite the DEFAULT_MAX_SEARCH_RESULT.- Specified by:
getTotalHitsin interfaceSearchService- Parameters:
sSearchTerm-maxResult- - max search result- Returns:
- total hits of search result
- Throws:
QueryException- in case the searchterm is not understandable.- See Also:
search(String, int, int, Sort, Operator)
-
-