com.raritantechnologies.vqlparser
Class XMLQueryRules

java.lang.Object
  extended bycom.raritantechnologies.vqlparser.XMLQueryRules
All Implemented Interfaces:
QueryRules

public class XMLQueryRules
extends java.lang.Object
implements QueryRules

Contains all the logic for Query Rules, which are applied for an advanced search against specific fields.

Rules Configuration:
 <Rules>                                                                 
   <Rule group="A" op="" field="ALL" wordMin="0" wordMax="5" id="1"> 
     [ the query text ]
   </Rule>
   ...
 </Rules>

 The query text is formatted using the following expressions:

	UQ = The user's query. Extra spaces are trimmed.

	CQ = The user's query with spaces turned into commas (the
		Verity OR operator).  Query words that are Verity
		operators are quoted.  E.g. manners and customs becomes
		manners,'AND',customs. should be AND(manners,'AND',customs)

	QCQ = The same as CQ except each term has stemming turned off.
		E.g. manners and customs becomes "manners","AND","customs"

  {n} = The word count + n. For example: query="Joe Smith"AU
 


Constructor Summary
XMLQueryRules()
          Constructors
 
Method Summary
 java.util.List getRulesFields()
          Return all fields which have Rules associated with them
 void initialize(org.w3c.dom.Node document)
          Initialize the rules from the config XML (if necessary)
static void main(java.lang.String[] args)
           
 java.lang.String makeQuery(java.lang.String mStrQuery, java.lang.String op, java.lang.String field)
          Apply the rules to the query.
static java.lang.String QuoteOperators(java.lang.String in)
           
 void setGroup(java.lang.String s)
          sets the group of rules to use.
 void setStemming(boolean b)
          use the stemmed rules? (default=true)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLQueryRules

public XMLQueryRules()
Constructors

Method Detail

initialize

public void initialize(org.w3c.dom.Node document)
Description copied from interface: QueryRules
Initialize the rules from the config XML (if necessary)

Specified by:
initialize in interface QueryRules

getRulesFields

public java.util.List getRulesFields()
Return all fields which have Rules associated with them

Specified by:
getRulesFields in interface QueryRules

makeQuery

public java.lang.String makeQuery(java.lang.String mStrQuery,
                                  java.lang.String op,
                                  java.lang.String field)
Apply the rules to the query. Returns the cooked query

Specified by:
makeQuery in interface QueryRules

setStemming

public void setStemming(boolean b)
Description copied from interface: QueryRules
use the stemmed rules? (default=true)

Specified by:
setStemming in interface QueryRules

setGroup

public void setGroup(java.lang.String s)
Description copied from interface: QueryRules
sets the group of rules to use. allows for switching. default is * (use all)

Specified by:
setGroup in interface QueryRules

QuoteOperators

public static java.lang.String QuoteOperators(java.lang.String in)

main

public static void main(java.lang.String[] args)