|
Regain 2.1.0-STABLE API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.regain.search.SearchToolkit
public class SearchToolkit
A toolkit for the search JSPs containing helper methods.
Field Summary | |
---|---|
private static String |
FIELD_PREFIX
The prefix for request parameters that contain additional field values. |
private static String |
FIELD_PREFIX_NOSTRING
The prefix for request parameters that contain additional field values that is not a string. |
private static String |
INDEX_CONFIG_CONTEXT_ARRAY_ATTR_NAME
The name of the page context attribute that holds the IndexConfig array. |
private static SearchConfig |
mConfig
The configuration of the search mask. |
private static HashMap<String,String> |
mMimeTypeHash
Holds for an extension the mime type. |
private static String |
SEARCH_QUERY_CONTEXT_ATTR_NAME
The name of the page context attribute that holds the search query. |
private static String |
SEARCH_RESULTS_ATTR_NAME
The name of the page context attribute that holds the SearchResults. |
Constructor Summary | |
---|---|
SearchToolkit()
|
Method Summary | |
---|---|
static org.apache.lucene.search.BooleanQuery |
addAccessControlToQuery(org.apache.lucene.search.Query query,
String[] allGroups)
Restrict query: only allow documents that have one group of allGroups (To be used together with SearchAccessController) |
static boolean |
allowFileAccess(PageRequest request,
String fileUrl)
Decides whether the remote access to a file should be allowed. |
static String |
encodeFileUrl(String url,
String encoding)
Create a URL that targets the file-to-http-bridge Counterpart to extractFileUrl |
static String |
extractFileUrl(String requestPath,
String encoding)
Extracts the file URL from a request path. |
static IndexConfig[] |
getAllIndexConfigArr(PageRequest request)
Gets the IndexConfig array from the configurationn. |
static String |
getCompressedFieldValue(org.apache.lucene.document.Document doc,
String fieldname)
Get the content of a compressed lucene field. |
static IndexConfig[] |
getIndexConfigArr(PageRequest request)
Gets the IndexConfig array from the PageContext. |
static IndexConfig[] |
getIndexConfigArrWithParent(PageRequest request)
Gets the IndexConfig array from the PageContext. |
static String |
getSearchQuery(PageRequest request)
Gets the search query. |
static SearchResults |
getSearchResults(PageRequest request)
Gets the SearchResults from the PageContext. |
private static void |
loadConfiguration(PageRequest request)
Loads the configuration of the search mask. |
static void |
sendFile(PageRequest request,
PageResponse response,
File file)
Sends a file to the client. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final String SEARCH_QUERY_CONTEXT_ATTR_NAME
private static final String SEARCH_RESULTS_ATTR_NAME
private static final String INDEX_CONFIG_CONTEXT_ARRAY_ATTR_NAME
private static final String FIELD_PREFIX
private static final String FIELD_PREFIX_NOSTRING
private static SearchConfig mConfig
private static HashMap<String,String> mMimeTypeHash
Constructor Detail |
---|
public SearchToolkit()
Method Detail |
---|
public static IndexConfig[] getIndexConfigArr(PageRequest request) throws RegainException
If there is no IndexConfig array in the PageContext it is put in the PageContext, so the next call will find it.
request
- The page request where the IndexConfig array will be taken from or put to.
RegainException
- If there is no IndexConfig for the specified index.public static IndexConfig[] getIndexConfigArrWithParent(PageRequest request) throws RegainException
If there is no IndexConfig array in the PageContext it is put in the PageContext, so the next call will find it.
request
- The page request where the IndexConfig array will be taken from or put to.
RegainException
- If there is no IndexConfig for the specified index.public static IndexConfig[] getAllIndexConfigArr(PageRequest request) throws RegainException
RegainException
- If there is no IndexConfig for the specified index.public static String getSearchQuery(PageRequest request) throws RegainException
request
- The request to get the query from.
RegainException
- If getting the query failed.public static SearchResults getSearchResults(PageRequest request) throws RegainException
If there is no SearchResults in the PageContext it is created and put in the PageContext, so the next call will find it.
request
- The page request where the SearchResults will be taken from or put to.
RegainException
- If the SearchResults could not be created.SearchResults
public static String extractFileUrl(String requestPath, String encoding) throws RegainException
requestPath
- The request path to extract the file URL from.encoding
- The encoding to use for the URL-docoding of the requestPath.
RegainException
- If extracting the file URL failed.LinkTag
public static String encodeFileUrl(String url, String encoding) throws RegainException
url
- URL of the file that should be encodedencoding
- Character encoding to use
RegainException
- If encoding the file URL failed.public static boolean allowFileAccess(PageRequest request, String fileUrl) throws RegainException
The access is granted if the file is in the index. The access is never granted for indexes that have an access controller.
request
- The request that holds the used index.fileUrl
- The URL to file to check.
RegainException
- If checking the file failed.public static org.apache.lucene.search.BooleanQuery addAccessControlToQuery(org.apache.lucene.search.Query query, String[] allGroups)
query
- Query to be modifiedallGroups
- Groups of the user
public static void sendFile(PageRequest request, PageResponse response, File file) throws RegainException
request
- The request.response
- The response.file
- The file to send.
RegainException
- If sending the file failed.public static String getCompressedFieldValue(org.apache.lucene.document.Document doc, String fieldname) throws RegainException
doc
- Lucene Index entryfieldname
- Index entry name
RegainException
- If decompression failed.private static void loadConfiguration(PageRequest request) throws RegainException
If the configuration is already loaded, nothing is done.
request
- The page request. Used to get the "configFile" init
parameter, which holds the name of the configuration file.
RegainException
- If loading failed.
|
Regain 2.1.0-STABLE API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |