@DeclareRoles(value={"org.imixs.ACCESSLEVEL.NOACCESS","org.imixs.ACCESSLEVEL.READERACCESS","org.imixs.ACCESSLEVEL.AUTHORACCESS","org.imixs.ACCESSLEVEL.EDITORACCESS","org.imixs.ACCESSLEVEL.MANAGERACCESS"}) @RolesAllowed(value={"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
escpeSearchTerm. This method prepends a
\ for those characters that QueryParser expects to be escaped.did-not-update-the-index-when-called-from-a-web-modul| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MAX_SEARCH_RESULT |
static int |
DEFAULT_PAGE_SIZE |
| Constructor and Description |
|---|
LuceneSearchService() |
| Modifier and Type | Method and Description |
|---|---|
static String |
escapeSearchTerm(String searchTerm) |
static String |
escapeSearchTerm(String searchTerm,
boolean ignoreBracket)
This helper method escapes wildcard tokens found in a lucene search term.
|
void |
flush()
This method flush the event log.
|
int |
getTotalHits(String sSearchTerm,
int maxResult,
org.apache.lucene.queryparser.classic.QueryParser.Operator defaultOperator)
Returns the total hits for a given search term from the lucene index.
|
static String |
normalizeSearchTerm(String searchTerm)
This method normalizes a search term using the Lucene ClassicTokenzier.
|
List<ItemCollection> |
search(String sSearchTerm)
Returns a collection of documents matching the provided search term.
|
List<ItemCollection> |
search(String sSearchTerm,
int pageSize,
int pageIndex)
Returns a collection of documents matching the provided search term.
|
List<ItemCollection> |
search(String sSearchTerm,
int pageSize,
int pageIndex,
org.apache.lucene.search.Sort sortOrder,
org.apache.lucene.queryparser.classic.QueryParser.Operator defaultOperator)
Returns a collection of documents matching matching the provided search term.
|
public static final int DEFAULT_MAX_SEARCH_RESULT
public static final int DEFAULT_PAGE_SIZE
public List<ItemCollection> search(String sSearchTerm) throws QueryException
sSearchTerm - QueryExceptionpublic List<ItemCollection> search(String sSearchTerm, int pageSize, int pageIndex) throws QueryException
pageSize - - docs per pagepageIndex - - page numberQueryExceptionpublic List<ItemCollection> search(String sSearchTerm, int pageSize, int pageIndex, org.apache.lucene.search.Sort sortOrder, org.apache.lucene.queryparser.classic.QueryParser.Operator defaultOperator) throws QueryException
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
sSearchTerm - pageSize - - docs per pagepageIndex - - page numbersortOrder - - optional to sort the resultdefaultOperator - - optional to change the default search operatorQueryException - in case the searchtem is not understandable.public void flush()
public int getTotalHits(String sSearchTerm, int maxResult, org.apache.lucene.queryparser.classic.QueryParser.Operator defaultOperator) throws QueryException
sSearchTerm - maxResult - - max search resultQueryException - in case the searchterm is not understandable.search(String, int, int, Sort, Operator)public static String escapeSearchTerm(String searchTerm, boolean ignoreBracket)
QueryParser.escape method and did
not! escape '*' char.
Clients should use the method normalizeSearchTerm() instead of
escapeSearchTerm() to prepare a user input for a lucene search.searchTerm - ignoreBracket - - if true brackes will not be escaped.normalizeSearchTermpublic static String normalizeSearchTerm(String searchTerm) throws QueryException
searchTerm - QueryExceptionCopyright © 2006–2019 Imixs Software Solutions GmbH. All rights reserved.