Regain 2.1.0-STABLE API

net.sf.regain.search.config
Class IndexConfig

java.lang.Object
  extended by net.sf.regain.search.config.IndexConfig

public class IndexConfig
extends Object

The configuration for one index.

Author:
Tilman Schneider, STZ-IDA an der FH Karlsruhe

Field Summary
protected static String[] DEFAULT_SEARCH_FIELD_LIST
          Default list of index fields to search in.
private  String mDirectory
          The directory where the index is located.
private  boolean mHasParent
          Index has a parent
private  String mName
          The name of the index.
private  String mOpenInNewWindowRegex
          The regular expression that identifies URLs that should be opened in a new window.
private  boolean mParent
          Index is used as parent cover
private  String mParentName
          Name of the parent (only used if mHasParent is true)
private  String[][] mRewriteRules
          The URL rewrite rules.
private  SearchAccessController mSearchAccessController
          The SearchAccessController to use.
private  String[] mSearchFieldList
          The index fields to search by default.
private  boolean mShouldHighlight
          Flag for highlighting of the search terms in the results
private  boolean mShowSortFieldContent
           
private  SortingOption[] mSortingOptions
          The sorting options for the results.
private  boolean mUseFileToHttpBridge
          Whether the file-to-http-bridge should be used.
 
Constructor Summary
IndexConfig(String name, String directory, String openInNewWindowRegex, boolean useFileToHttpBridge, String[] searchFieldList, String[][] rewriteRules, String searchAccessControllerClass, String searchAccessControllerJar, Properties searchAccessControllerConfig, boolean shouldHighlight, SortingOption[] sortingOptions, boolean showSortFieldContent)
          Creates a new instance of IndexConfig.
 
Method Summary
 String getDirectory()
          Gets the directory where the index is located.
 String getName()
          Gets the name of the index.
 String getOpenInNewWindowRegex()
          Gets the regular expression that identifies URLs that should be opened in a new window.
 String getParentName()
          Gets the name of the parent index.
 String[][] getRewriteRules()
          Gets the URL rewrite rules.
 SearchAccessController getSearchAccessController()
          Gets the SearchAccessController to use.
 String[] getSearchFieldList()
          Gets the index fields to search by default.
 boolean getShouldHighlight()
          Gets the flag for highlighting of the search terms
 boolean getShowSortFieldContent()
           
 SortingOption[] getSortingOptions()
           
 boolean getUseFileToHttpBridge()
          Gets whether the file-to-http-bridge should be used for file-URLs.
 boolean hasParent()
          Is index has a parent index?
 boolean isParent()
          Is index a child of a parent index?
 void setParent(String parent)
          Set index as parent if parent is "true" otherwise set false
 void setParentName(String parentName)
          Set the name of the parent index
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SEARCH_FIELD_LIST

protected static final String[] DEFAULT_SEARCH_FIELD_LIST
Default list of index fields to search in.


mName

private String mName
The name of the index.


mDirectory

private String mDirectory
The directory where the index is located.


mOpenInNewWindowRegex

private String mOpenInNewWindowRegex
The regular expression that identifies URLs that should be opened in a new window.


mUseFileToHttpBridge

private boolean mUseFileToHttpBridge
Whether the file-to-http-bridge should be used.


mSearchFieldList

private String[] mSearchFieldList
The index fields to search by default.

NOTE: The user may search in other fields also using the "field:"-operator. Read the lucene query syntax for details.


mRewriteRules

private String[][] mRewriteRules
The URL rewrite rules.

Contains pairs of URL prefixes: The first prefix will be replaced by the second.

E.g.:

 new String[][] {
   { "file://c:/webcontent", "http://www.mydomain.de" },
   { "file://n:/docs", "file://///fileserver/public/docs" },
 };
 


mSearchAccessController

private SearchAccessController mSearchAccessController
The SearchAccessController to use. May be null.


mShouldHighlight

private boolean mShouldHighlight
Flag for highlighting of the search terms in the results


mParent

private boolean mParent
Index is used as parent cover


mHasParent

private boolean mHasParent
Index has a parent


mParentName

private String mParentName
Name of the parent (only used if mHasParent is true)


mSortingOptions

private SortingOption[] mSortingOptions
The sorting options for the results.


mShowSortFieldContent

private boolean mShowSortFieldContent
Constructor Detail

IndexConfig

public IndexConfig(String name,
                   String directory,
                   String openInNewWindowRegex,
                   boolean useFileToHttpBridge,
                   String[] searchFieldList,
                   String[][] rewriteRules,
                   String searchAccessControllerClass,
                   String searchAccessControllerJar,
                   Properties searchAccessControllerConfig,
                   boolean shouldHighlight,
                   SortingOption[] sortingOptions,
                   boolean showSortFieldContent)
            throws RegainException
Creates a new instance of IndexConfig.

Parameters:
name - The name of the index.
directory - The directory where the index is located.
openInNewWindowRegex - The regular expression that identifies URLs that should be opened in a new window.
useFileToHttpBridge - Whether the file-to-http-bridge should be used. See getUseFileToHttpBridge() for details.
searchFieldList - The index fields to search by default.
rewriteRules - The URL rewrite rules. Contains pairs of URL prefixes: The first prefix will be replaced by the second.
searchAccessControllerClass - The class name of the SearchAccessController to use.
searchAccessControllerJar - The name of jar file to load the SearchAccessController from.
searchAccessControllerConfig - The configuration for the SearchAccessController.
shouldHighlight - The flag for highlighting of the search terms in the results
Throws:
RegainException - If loading the SearchAccessController failed.
Method Detail

getName

public String getName()
Gets the name of the index.

Returns:
The name of the index.

getDirectory

public String getDirectory()
Gets the directory where the index is located.

Returns:
The directory where the index is located.

getOpenInNewWindowRegex

public String getOpenInNewWindowRegex()
Gets the regular expression that identifies URLs that should be opened in a new window.

Returns:
The regular expression that identifies URLs that should be opened in a new window.

getUseFileToHttpBridge

public boolean getUseFileToHttpBridge()
Gets whether the file-to-http-bridge should be used for file-URLs.

Mozilla browsers have a security mechanism that blocks loading file-URLs from pages loaded via http. To be able to load files from the search results, regain offers the file-to-http-bridge that provides all files that are listed in the index via http.

Returns:
Whether the file-to-http-bridge should be used.

getSearchFieldList

public String[] getSearchFieldList()
Gets the index fields to search by default.

NOTE: The user may search in other fields also using the "field:"-operator. Read the lucene query syntax for details.

Returns:
The index fields to search by default.

getRewriteRules

public String[][] getRewriteRules()
Gets the URL rewrite rules.

The returned array contains pairs of URL prefixes: The first prefix will be replaced by the second.

E.g.:

 new String[][] {
   { "file://c:/webcontent", "http://www.mydomain.de" },
   { "file://n:/docs", "file://///fileserver/public/docs" },
 };
 

Returns:
The URL rewrite rules. May be null;

getSearchAccessController

public SearchAccessController getSearchAccessController()
Gets the SearchAccessController to use. Returns null if no SearchAccessController should be used.

Returns:
The SearchAccessController.

getShouldHighlight

public boolean getShouldHighlight()
Gets the flag for highlighting of the search terms

Returns:
the flag for highlighting

hasParent

public boolean hasParent()
Is index has a parent index?

Returns:
true if index has a parent false if index has no parent

isParent

public boolean isParent()
Is index a child of a parent index?

Returns:
true if index is a parent index false if index is not a parent index

setParent

public void setParent(String parent)
Set index as parent if parent is "true" otherwise set false

Parameters:
parent - is index a parent index?

getParentName

public String getParentName()
Gets the name of the parent index.

Returns:
The name of the parent index.

setParentName

public void setParentName(String parentName)
Set the name of the parent index

Parameters:
parentName - Name of the parent index

getSortingOptions

public SortingOption[] getSortingOptions()
Returns:
the sortingOptions

getShowSortFieldContent

public boolean getShowSortFieldContent()
Returns:
the mShowSortFieldContent

Regain 2.1.0-STABLE API

Regain 2.1.0-STABLE, Copyright (C) 2004-2010 Til Schneider, www.murfman.de, Thomas Tesche, www.clustersystems.info