com.raritantechnologies.verity
Class QueryCooker

java.lang.Object
  extended bycom.raritantechnologies.verity.QueryCooker
All Implemented Interfaces:
IQueryCooker

public class QueryCooker
extends java.lang.Object
implements IQueryCooker

Base implementation of IQueryCooker interface.

Each QueryCooker implementation must convert a set of form parameters contained in a OrderedMap into a VQL string. The ConfigurationManager ensures that the QueryCooker is correctly matched to an input form.

The OrderedMap that is passed to the IQueryCooker methods cn be derived from the web form ServletRequest. It contains a map of String keys to String array (String[]) values as described in the ServletRequest.getParameterMap( ) javadoc page.

It can take a set of fields that should be ORed together, all other fields are ANDed together.

The freeTextField is the name of the field (usually named query) where the user can search against all fields/zones in Verity. This can be limited with the NoFreeText limit in the fields. This prevents queries like title foo foo which Verity doesn't like .

It is also possible to map the value of one field to the value of another field by setting a fields value to "_MAPTO_[other field name]" in the configuration xml. This can be used in an instance where you have a text box and you want to search for it's value in a series of checkboxes.

   <QueryCooker class="com.raritantechnologies.verity.QueryCooker">
      <FreeTextField name="query" />
      <orFields>
          <orField name="RTI_Title" />
          <orField name="VDKSUMMARY" />
          <orField name="VDKFEATURES" />
      </orFields>
  </QueryCooker>
 


Developed by Raritan Technologies .

Author:
Ted Sullivan, Glenn Robitaille

Field Summary
static java.lang.String dateField1OpPrefix
           
static java.lang.String dateField1Prefix
           
static java.lang.String dateField2OpPrefix
           
static java.lang.String dateField2Prefix
           
static boolean DEBUG
           
static java.lang.String fieldPrefix
           
static java.lang.String fieldSeparator
           
static java.lang.String TokenSeparator
          TokenSeparator is the character used to separate value tokens.
 
Constructor Summary
QueryCooker()
           
 
Method Summary
 java.lang.String getHighlightQuery(java.lang.String[] searchSources, OrderedMap queryParams, ISearchFieldMap searchMap, ILoginInfo userInfo)
          returns a query suitable for use with Verity highlighting processes.
 java.lang.String getSourceQuery(java.lang.String[] searchSources, OrderedMap queryParams, ISearchFieldMap searchMap, ILoginInfo userInfo)
          returns a Verity Query Language (VQL) Source Query.
 java.lang.String getVerityQuery(java.lang.String[] searchSources, OrderedMap qps, ISearchFieldMap searchMap, ILoginInfo userInfo)
          returns a Verity Query Language (VQL) string for the form parameters submitted in queryParams.
 void initialize(org.w3c.dom.Element elem)
          Initialize the display form renderer from the configuration XML.
static java.lang.String TranslateSpecialCharacters(java.lang.String s)
          This method replaces certain special characters with ' ', to avoid the construction of corrupt VQL statements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final boolean DEBUG
See Also:
Constant Field Values

TokenSeparator

public static final java.lang.String TokenSeparator
TokenSeparator is the character used to separate value tokens.

See Also:
Constant Field Values

fieldSeparator

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

fieldPrefix

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

dateField1Prefix

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

dateField1OpPrefix

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

dateField2Prefix

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

dateField2OpPrefix

public static final java.lang.String dateField2OpPrefix
See Also:
Constant Field Values
Constructor Detail

QueryCooker

public QueryCooker()
Method Detail

initialize

public void initialize(org.w3c.dom.Element elem)
Initialize the display form renderer from the configuration XML.

Specified by:
initialize in interface IQueryCooker

getVerityQuery

public java.lang.String getVerityQuery(java.lang.String[] searchSources,
                                       OrderedMap qps,
                                       ISearchFieldMap searchMap,
                                       ILoginInfo userInfo)
Description copied from interface: IQueryCooker
returns a Verity Query Language (VQL) string for the form parameters submitted in queryParams. The Search sources are needed to map the input params to the verity collection fields. This mapping can be different for different search sources.

Specified by:
getVerityQuery in interface IQueryCooker

getSourceQuery

public java.lang.String getSourceQuery(java.lang.String[] searchSources,
                                       OrderedMap queryParams,
                                       ISearchFieldMap searchMap,
                                       ILoginInfo userInfo)
Description copied from interface: IQueryCooker
returns a Verity Query Language (VQL) Source Query.

Specified by:
getSourceQuery in interface IQueryCooker

getHighlightQuery

public java.lang.String getHighlightQuery(java.lang.String[] searchSources,
                                          OrderedMap queryParams,
                                          ISearchFieldMap searchMap,
                                          ILoginInfo userInfo)
Description copied from interface: IQueryCooker
returns a query suitable for use with Verity highlighting processes.

Specified by:
getHighlightQuery in interface IQueryCooker

TranslateSpecialCharacters

public static java.lang.String TranslateSpecialCharacters(java.lang.String s)
This method replaces certain special characters with ' ', to avoid the construction of corrupt VQL statements.