|
Qizx fe-4.4p2 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.qizx.api.Indexing
public class Indexing
Specification of rules and parameters used to build indexes in a XML Library.
An instance of this class is associated with each XML Library. It can be represented in XML, thus read and written in this format. A DTD is provided in the documentation.
The direct use of this class is recommended only for very advanced problems, for example when an indexing specification needs to be generated dynamically. In most cases, an indexing specification is written in XML. Its most common use consists of defining specific Numeric or Date Sieves, or to tune parameters like minWordLength.
Nested Class Summary | |
---|---|
static interface |
Indexing.DateSieve
Pluggable analyzer/converter of date-time values, for custom indexing. |
static interface |
Indexing.NumberSieve
Pluggable analyzer/converter of numeric values, for custom indexing. |
static class |
Indexing.Rule
Indexing properties associated with an element or an attribute (for advanced indexing). |
static interface |
Indexing.Sieve
Abstraction of Sieves used for indexing XML data. |
static interface |
Indexing.WordSieve
Deprecated. replaced by TextTokenizer |
Field Summary | |
---|---|
static byte |
DATE
Indexing type for a rule: attempt to convert element or attribute text content with a DateSieve then put it to date index. |
static byte |
DATE_AND_STRING
Indexing type for a rule: same as both DATE and STRING. |
static byte |
DISABLE_FULL_TEXT
Value for full-text option (global or per rule) disabling full-text. |
static byte |
ENABLE_FULL_TEXT
Value for full-text option (global or per rule) enabling full-text. |
static byte |
INHERIT
Default value for full-text on a Rule: inherit from parent element or from global setting. |
static byte |
NUMERIC
Indexing type for a rule: attempt to convert element or attribute text content with a NumberSieve then put it to numeric index. |
static byte |
NUMERIC_AND_STRING
Indexing type for a rule: same as both NUMERIC and STRING. |
static byte |
STRING
Indexing type for a rule: text fragment directly put to string index if length is less than max-string-length. |
Constructor Summary | |
---|---|
Indexing()
Creates an empty indexing configuration. |
Method Summary | |
---|---|
FormatDateSieve |
addAttrDateSieve(String format,
Locale locale,
QName attributeName,
QName[] context)
A Convenience method that adds a format-based DateSieve for a specific attribute |
Indexing.Rule |
addAttributeRule(QName attributeName,
QName[] context,
int indexingType)
Adds a new Rule applicable to a specific attribute. |
FormatNumberSieve |
addAttrNumberSieve(String format,
Locale locale,
QName attributeName,
QName[] context)
A Convenience method that adds a format-based NumberSieve for a specific attribute |
Indexing.DateSieve |
addDateSieve(String format,
Locale locale,
QName elementName,
QName[] context)
A Convenience method that adds a format-based DateSieve for a specific element |
Indexing.Rule |
addDefaultAttributeRule(QName[] context,
int indexingType)
Adds a new Rule applicable to all attributes. |
Indexing.Rule |
addDefaultElementRule(QName[] context,
int indexingType)
Adds a new Rule applicable to all elements. |
Indexing.Rule |
addElementRule(QName elementName,
QName[] context,
int indexingType)
Adds a new Rule applicable to a specific element. |
FormatNumberSieve |
addNumberSieve(String format,
Locale locale,
QName elementName,
QName[] context)
A Convenience method that adds a format-based DateSieve for a specific element |
double |
convertDate(Node node)
Attempts to convert the date or date-time contained in the text fragment to a double value (in milliseconds from 1970-01-01 00:00:00 UTC). |
double |
convertNumber(Node node)
Attempts to convert the string to a double value. |
static Indexing |
defaultRules()
Creates a default indexing configuration. |
void |
export(XMLPushStream stream)
Converts to an external representation. |
Indexing.Rule |
getAttributeRule(int index)
Returns the n-th attribute Rule. |
int |
getAttributeRuleCount()
Returns the number of defined Attribute rules, including default rules. |
Indexing.Rule |
getElementRule(int index)
Returns the n-th element Rule. |
int |
getElementRuleCount()
Returns the number of defined Element rules, including default rules. |
int |
getMaxStringLength()
Returns the maximum length of text chunks that can be indexed in value indexes (Attribute and Simple element content). |
int |
getMaxWordLength()
Returns the maximum length of words that can be indexed in the Full-text index. |
int |
getMinWordLength()
Returns the minimum length of words that can be indexed in the Full-text index. |
Indexing.WordSieve |
getWordSieve()
Returns the word sieve used for full-text indexing. |
boolean |
isFulltextEnabled()
Returns true if full-text indexing is globally enabled for elements. |
void |
parse(InputSource source)
Parses an Indexing specification from XML text representation. |
void |
parse(InputSource source,
XMLReader parser)
Parses an Indexing specification from XML text representation. |
void |
parse(Node specification)
Parses an Indexing specification from a Node. |
void |
setFulltextEnabled(boolean fulltext)
Enables or disables full-text indexing globally. |
void |
setMaxStringLength(int maxStringLength)
Defines the maximum length of text chunks that can be indexed in value indexes (Attribute and Simple element content). |
void |
setMaxWordLength(int maxWordLength)
Defines the maximum length of words that can be indexed in the Full-text index. |
void |
setMinWordLength(int minWordLength)
Defines the minimum length of words that can be indexed in the Full-text index. |
void |
setWordSieve(Indexing.WordSieve wordSieve)
Defines the word sieve used for full-text indexing. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte STRING
public static final byte NUMERIC
public static final byte NUMERIC_AND_STRING
public static final byte DATE
public static final byte DATE_AND_STRING
public static final byte INHERIT
public static final byte DISABLE_FULL_TEXT
public static final byte ENABLE_FULL_TEXT
Constructor Detail |
---|
public Indexing()
Method Detail |
---|
public static Indexing defaultRules()
public void parse(InputSource source) throws QizxException
source
- a SAX input source for the specification
QizxException
- on on IO error, SAX parsing error, if the indexing
specification is invalidpublic void parse(InputSource source, XMLReader parser) throws QizxException
source
- a SAX input source for the specificationparser
- a SAX parser explicitly specified
QizxException
- on on IO error, SAX parsing error, if the indexing
specification is invalidpublic void parse(Node specification) throws DataModelException
specification
- a node of type document or element which is the root
of an indexing specification.
DataModelException
- if the indexing specification is invalidpublic void export(XMLPushStream stream) throws DataModelException
stream
- a Push style interface (for example XMLSerializer).
DataModelException
- if generated by the output streampublic Indexing.Rule addElementRule(QName elementName, QName[] context, int indexingType)
elementName
- specific element namecontext
- enclosing elements (optional, may be null)indexingType
- possible values are STRING, NUMERIC, DATE,
NUMERIC_AND_STRING, DATE_AND_STRING
public Indexing.Rule addDefaultElementRule(QName[] context, int indexingType)
context
- enclosing elements (optional, may be null)indexingType
- possible values are STRING, NUMERIC, DATE,
NUMERIC_AND_STRING, DATE_AND_STRING
public int getElementRuleCount()
public Indexing.Rule getElementRule(int index)
index
- an index starting from 0
public Indexing.Rule addAttributeRule(QName attributeName, QName[] context, int indexingType)
attributeName
- specific attribute namecontext
- enclosing elements (optional, may be null)indexingType
- possible values are STRING, NUMERIC, DATE,
NUMERIC_AND_STRING, DATE_AND_STRING
public Indexing.Rule addDefaultAttributeRule(QName[] context, int indexingType)
context
- enclosing elements (optional, may be null)indexingType
- possible values are STRING, NUMERIC, DATE,
NUMERIC_AND_STRING, DATE_AND_STRING
public int getAttributeRuleCount()
public Indexing.Rule getAttributeRule(int index)
index
- an index starting from 0
public Indexing.WordSieve getWordSieve()
public void setWordSieve(Indexing.WordSieve wordSieve)
Note: the word sieve is unique because it is also used for parsing full-text queries.
wordSieve
- in implementation of WordSieve. Must not be null.public int getMaxStringLength()
The default value is 50
public void setMaxStringLength(int maxStringLength)
maxStringLength
- the maximum length desiredpublic int getMaxWordLength()
public void setMaxWordLength(int maxWordLength)
maxWordLength
- word length in characterspublic int getMinWordLength()
public void setMinWordLength(int minWordLength)
minWordLength
- word length in characterspublic boolean isFulltextEnabled()
By default, full-text indexing is globally enabled. It can be disabled with setFulltextEnabled(), or by an attribute full-text='false' in an indexing specification.
public void setFulltextEnabled(boolean fulltext)
fulltext
- true to enable full-text indexing globallypublic Indexing.DateSieve addDateSieve(String format, Locale locale, QName elementName, QName[] context)
format
- a date format as supported by SimpleDateFormat
and
FormatDateSieve.locale
- optional locale used for creating the format (if null,
the default locale is used).elementName
- required name of the elementcontext
- optional element context
public FormatDateSieve addAttrDateSieve(String format, Locale locale, QName attributeName, QName[] context)
format
- a date format as supported by SimpleDateFormat
and
FormatDateSieve.locale
- optional locale used for creating the format (if null, the
default locale is used).attributeName
- required name of the attributecontext
- optional element context
public FormatNumberSieve addNumberSieve(String format, Locale locale, QName elementName, QName[] context)
format
- a date format as supported by SimpleDateFormat
and
FormatDateSieve.locale
- optional locale used for creating the format (if null, the
default locale is used).elementName
- required name of the elementcontext
- optional element context
public FormatNumberSieve addAttrNumberSieve(String format, Locale locale, QName attributeName, QName[] context)
format
- a date format as supported by DecimalFormat
and
FormatNumberSieve.locale
- optional locale used for creating the format (if null,
the default locale is used).attributeName
- required name of the attributecontext
- optional element context
public double convertNumber(Node node)
com.qizx.xdm.DataConversion
convertNumber
in interface com.qizx.xdm.DataConversion
public double convertDate(Node node)
com.qizx.xdm.DataConversion
convertDate
in interface com.qizx.xdm.DataConversion
|
© 2010 Axyana Software | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |