com.toalango.qzarch
Class SearchEngineConfig

java.lang.Object
  |
  +--com.toalango.qzarch.SearchEngineConfig

public class SearchEngineConfig
extends java.lang.Object

This configuration object is passed on to the search engine as an argument to one of the constructors of the engine.

Most of the configurable settings have defaults in order to minimize the need of configuring the engine if it is used without any particular customisation needs.

Author:
Rune Toalango Johannesen

Field Summary
static java.lang.String DEFAULT_DIRECTORY_LARGE_ICONS
           
static java.lang.String DEFAULT_DIRECTORY_SMALL_ICONS
           
static java.lang.String DEFAULT_ICON
          The file name of the default icons
static java.lang.String INIT_CASE_SENSITIVE
           
static java.lang.String INIT_EXCLUDE_BASE
           
static java.lang.String INIT_EXCLUDE_BASES
           
static java.lang.String INIT_EXPRESSION_SUPPORT
           
static java.lang.String INIT_EXTRACT_TITLES
           
static java.lang.String INIT_FILE_TYPE
           
static java.lang.String INIT_FILE_TYPES
           
static java.lang.String INIT_ICONS
           
static java.lang.String INIT_ICONS_LARGE
           
static java.lang.String INIT_ICONS_SMALL
           
static java.lang.String INIT_MOUNTED_ROOT
          The mounted-root is the complete path to the document root directory.
static java.lang.String INIT_RELATIVE_ROOT
          The root-relative-to-servlet is used to produce links to the documents in the result list and the icons.
static java.lang.String INIT_SEARCH_BASE
          The search-base can be used if the search engine is going to be configured with one single directory as the search base.
static java.lang.String INIT_SEARCH_BASES
          The search-bases can be used to configure the search engine with multiple search base directories.
 
Constructor Summary
SearchEngineConfig()
           
 
Method Summary
 void addExcludeBase(java.lang.String pDirectoryName)
          Add an exclude base directory for the searches.
 void addSearchBase(java.lang.String pDirectoryName)
          Add a base directory for the searches.
 java.io.File[] getExcludeBases()
          Getter method for the base directories for the searches.
 java.lang.String[] getFileTypes()
          Getter method for the file types that this instance of the serarch engine is configured to use by default if the calling client doesn't pass on this argument in the calls.
 java.util.Map getLargeIcons()
           
 java.io.File getMountedRootDirectory()
          Getter method for the directory mounted as the document root.
 java.lang.String getResourcePath(java.io.File pFile)
          This method maps the physical file name to the resource path required by the web server.
 java.lang.String getRootRelativeToServlet()
          Returns the relative path from the virtual directory of the search servlet to the mounted root without a trailing slash.
 java.io.File[] getSearchBases()
          Getter method for the base directories for the searches.
 java.util.Map getSmallIcons()
           
 boolean isCaseSensitive()
          Will the searches be performed case-sensitive by default unless the case-sensitive argument is passed together with the search call?
 boolean isExtractingTitles()
          Getter method for the propety whether to extract titles for the known file type or not.
 boolean isSupportingExpressions()
          Getter method for the expression support property.
 void setCaseSensitive(boolean pCaseSensitive)
          Setter method for the case sensitive property
 void setExtractingTitles(boolean pExtractingTitles)
          Setter method for the extraction of titles from the source files in the result set.
 void setFileTypes(java.lang.String[] pFileTypes)
          Setter method for the file types that this instance of the serarch engine going to use by default if the calling client doesn't pass on this argument in the calls.
 void setLargeIconsLocation(java.io.File pDirectory)
          Setter method for the large icons directory.
 void setMountedRootDirectory(java.io.File pMountedRootDirectory)
          Setter method for the directory mounted as the document root.
 void setRootRelativeToServlet(java.lang.String pRootRelativeToServlet)
           
 void setSmallIconsLocation(java.io.File pDirectory)
          Setter method for the small icons directory.
 void setSupportingExpressions(boolean pSupportingExpressions)
          Setter method for the expression support property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INIT_MOUNTED_ROOT

public static final java.lang.String INIT_MOUNTED_ROOT
The mounted-root is the complete path to the document root directory. If not provided the real path of the context path provided by the servlet engine will be assumed to be the mounted root.

See Also:
Constant Field Values

INIT_RELATIVE_ROOT

public static final java.lang.String INIT_RELATIVE_ROOT
The root-relative-to-servlet is used to produce links to the documents in the result list and the icons. The search servlet is called using a "virtual" directory structure in the URL. For instance, http://my.domain.com/servlet/search has search as a virtual directory. The relative path to the mounted root is thus ../, which is the default setting if the configuration is omitted.

See Also:
Constant Field Values

INIT_SEARCH_BASE

public static final java.lang.String INIT_SEARCH_BASE
The search-base can be used if the search engine is going to be configured with one single directory as the search base. If not provided the search base might be set using the search-bases parameter for multiple directories. If neither search-base nor search-bases is provided the mounted root will be used as a single search base directory.

See Also:
Constant Field Values

INIT_SEARCH_BASES

public static final java.lang.String INIT_SEARCH_BASES
The search-bases can be used to configure the search engine with multiple search base directories. The directories must be enumerated using a comma-delimited string.

See Also:
INIT_SEARCH_BASE, Constant Field Values

INIT_EXCLUDE_BASE

public static final java.lang.String INIT_EXCLUDE_BASE
See Also:
Constant Field Values

INIT_EXCLUDE_BASES

public static final java.lang.String INIT_EXCLUDE_BASES
See Also:
Constant Field Values

INIT_CASE_SENSITIVE

public static final java.lang.String INIT_CASE_SENSITIVE
See Also:
Constant Field Values

INIT_EXPRESSION_SUPPORT

public static final java.lang.String INIT_EXPRESSION_SUPPORT
See Also:
Constant Field Values

INIT_FILE_TYPE

public static final java.lang.String INIT_FILE_TYPE
See Also:
Constant Field Values

INIT_FILE_TYPES

public static final java.lang.String INIT_FILE_TYPES
See Also:
Constant Field Values

INIT_ICONS

public static final java.lang.String INIT_ICONS
See Also:
Constant Field Values

INIT_ICONS_SMALL

public static final java.lang.String INIT_ICONS_SMALL
See Also:
Constant Field Values

INIT_ICONS_LARGE

public static final java.lang.String INIT_ICONS_LARGE
See Also:
Constant Field Values

DEFAULT_DIRECTORY_SMALL_ICONS

public static final java.lang.String DEFAULT_DIRECTORY_SMALL_ICONS
See Also:
Constant Field Values

DEFAULT_DIRECTORY_LARGE_ICONS

public static final java.lang.String DEFAULT_DIRECTORY_LARGE_ICONS
See Also:
Constant Field Values

INIT_EXTRACT_TITLES

public static final java.lang.String INIT_EXTRACT_TITLES
See Also:
Constant Field Values

DEFAULT_ICON

public static final java.lang.String DEFAULT_ICON
The file name of the default icons

See Also:
Constant Field Values
Constructor Detail

SearchEngineConfig

public SearchEngineConfig()
Method Detail

setMountedRootDirectory

public void setMountedRootDirectory(java.io.File pMountedRootDirectory)
Setter method for the directory mounted as the document root. The names of all directories from root down to (including) this directory will be removed in order to produce relative resource links used in any output of search results.

Parameters:
pMountedRootDirectory - The value of this property

getMountedRootDirectory

public java.io.File getMountedRootDirectory()
Getter method for the directory mounted as the document root. The names of all directories from root down to (including) this directory will be removed in order to produce relative resource links used in any output of search results.

Returns:
the file object representing the mounted root directory

setRootRelativeToServlet

public void setRootRelativeToServlet(java.lang.String pRootRelativeToServlet)

getRootRelativeToServlet

public java.lang.String getRootRelativeToServlet()
Returns the relative path from the virtual directory of the search servlet to the mounted root without a trailing slash.

Returns:
the initial path to all links to documents and icons in the result set
To do:
could the default value be derived from the mounted root and the servlet's path?

setFileTypes

public void setFileTypes(java.lang.String[] pFileTypes)
Setter method for the file types that this instance of the serarch engine going to use by default if the calling client doesn't pass on this argument in the calls.

Parameters:
pFileTypes -

getFileTypes

public java.lang.String[] getFileTypes()
Getter method for the file types that this instance of the serarch engine is configured to use by default if the calling client doesn't pass on this argument in the calls.

Returns:
The file types that this instance uses by default when executing searches

addSearchBase

public void addSearchBase(java.lang.String pDirectoryName)
Add a base directory for the searches.

Parameters:
pDirectoryName - The name of the directory to be included as a search base for this instance

getSearchBases

public java.io.File[] getSearchBases()
Getter method for the base directories for the searches.

Returns:
The search bases

getExcludeBases

public java.io.File[] getExcludeBases()
Getter method for the base directories for the searches.

Returns:
The search bases

addExcludeBase

public void addExcludeBase(java.lang.String pDirectoryName)
Add an exclude base directory for the searches.

Parameters:
pDirectoryName - The name of the directory to be included as an exclude base for this instance

setCaseSensitive

public void setCaseSensitive(boolean pCaseSensitive)
Setter method for the case sensitive property

Parameters:
pCaseSensitive - true or false

isCaseSensitive

public boolean isCaseSensitive()
Will the searches be performed case-sensitive by default unless the case-sensitive argument is passed together with the search call?

Returns:
true if the search engine is configured to perform case sensitive searches by default, otherwise false

setSupportingExpressions

public void setSupportingExpressions(boolean pSupportingExpressions)
Setter method for the expression support property.

Parameters:
pSupportingExpressions - are simple AND and OR expressions supported?

isSupportingExpressions

public boolean isSupportingExpressions()
Getter method for the expression support property.

Returns:
are simple AND and OR expressions supported?

setExtractingTitles

public void setExtractingTitles(boolean pExtractingTitles)
Setter method for the extraction of titles from the source files in the result set.

Parameters:
pExtractingTitles - the value of the property

isExtractingTitles

public boolean isExtractingTitles()
Getter method for the propety whether to extract titles for the known file type or not.

Returns:
the value of the peroperty

setSmallIconsLocation

public void setSmallIconsLocation(java.io.File pDirectory)
Setter method for the small icons directory. If this setter method isn't called the search engine will not assign icon paths to the resource objects returned in the search calls.

The small icons are supposed to be 16x16 pixels, in transparent .gif format.

Parameters:
pDirectory - The directory where all the small icons are to be found

setLargeIconsLocation

public void setLargeIconsLocation(java.io.File pDirectory)
Setter method for the large icons directory. If this setter method isn't called the search engine will not assign icon paths to the resource objects returned in the search calls.

The large icons are supposed to be 32x32 pixels, in transparent .gif format.

Parameters:
pDirectory - The directory where all the large icons are to be found

getResourcePath

public java.lang.String getResourcePath(java.io.File pFile)
This method maps the physical file name to the resource path required by the web server. The mounted root directory together with the relative path from the search servlet's location to the mounted root are used to compose the final (relative) path.

The path returned by this method can be used directly to reference documents that are visible for the end-users. It is used for both documents in the result set and the assosiated icons.

Parameters:
pFile - The physical file
Returns:
The virtual path to this resource on the web server, relative to the (virtual) directory of the search servlet

getSmallIcons

public java.util.Map getSmallIcons()

getLargeIcons

public java.util.Map getLargeIcons()