|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.dlese.dpc.index.writer.xml.XMLIndexer
public class XMLIndexer
Adds index fields to a Lucene Document
from any well-formed XML. Individual
field names are derived from the xPath to each element and attribute in the XML instance document. Fields
are encoded to support text, keyword and stemmed search. Also creates standard fields for IDs, URLs, title,
description and geospatial bounding box footprint. The 'default' and 'stems' fields are also indexed as text and stemmed text, respectively.
A XMLIndexerFieldsConfig
may be supplied to configure specific search fields for given XML
formats. If a field is defined in the XMLIndexerFieldsConfig, and content is avialable at the given xPath,
it will override the value set for ids, urls,
title or description. In addition, field values configured by schema override those configured by xmlFormat.
XMLIndexerFieldsConfig
Constructor Summary | |
---|---|
XMLIndexer(Document localizedXmlDocument,
String xmlFormat,
XMLIndexerFieldsConfig xmlIndexerFieldsConfig)
Constructor for the XMLIndexer object |
|
XMLIndexer(String xmlString,
String xmlFormat,
XMLIndexerFieldsConfig xmlIndexerFieldsConfig)
Constructor for the XMLIndexer object |
|
XMLIndexer(URL urlToXml,
String xmlFormat,
XMLIndexerFieldsConfig xmlIndexerFieldsConfig)
Constructor for the XMLIndexer object |
Method Summary | |
---|---|
BoundingBox |
getBoundingBox()
Returns the value of boundingBox. |
String |
getDescription()
Returns the value of description. |
String |
getFullXmlAttributeContent()
Gets the full content of each Attribute in the XML. |
String |
getFullXmlElementContent()
Gets the full content of each Element in the XML. |
String[] |
getIds()
Returns the value of ids. |
String[] |
getIdsEncoded()
Returns unique IDs for the item being indexed encoded for indexing. |
List |
getRelatedIds()
Gets the ids of related records. |
Map |
getRelatedIdsMap()
Gets the ids of related records. |
List |
getRelatedUrls()
Gets the urls of related records. |
Map |
getRelatedUrlsMap()
Gets the urls of related records. |
String |
getTitle()
Returns the value of title. |
String[] |
getUrls()
Returns the value of urls. |
Document |
getXmlDocument()
Gets the localized Dom4j Document for this XML instance. |
String |
getXPathFieldsPrefix()
Returns the value of xPathFieldsPrefix, or null if none. |
void |
indexFields(org.apache.lucene.document.Document luceneDoc)
Indexes the contents of the XML, adding fields to the Lucene Document that is supplied. |
boolean |
indexJavaBeanFields(org.apache.lucene.document.Document luceneDoc)
Indexes Java Bean XML that was encoded with the java.beans.XMLEncoder class, using the bean properties as field names. |
void |
indexXpathFields(org.apache.lucene.document.Document luceneDoc)
Indexes the content of each element and attribute in the source XML as individual search fields, using the xPath to the element or attribute as the field name. |
void |
setBoundingBox(BoundingBox boundingBox)
Sets the value of boundingBox. |
void |
setDescription(String description)
Sets the value of description. |
void |
setIds(String[] ids)
Sets the value of ids. |
void |
setIndexDefaultAndStemsField(boolean indexDefaultAndStemsField)
Sets whether to index the default, admindefault, and stems field for this record. |
void |
setTitle(String title)
Sets the value of title. |
void |
setUrls(String[] urls)
Sets the value of urls. |
void |
setXPathFieldsPrefix(String xPathFieldsPrefix)
Sets the value of xPathFieldsPrefix, which is appended at the front of the xPath fields when indexed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLIndexer(Document localizedXmlDocument, String xmlFormat, XMLIndexerFieldsConfig xmlIndexerFieldsConfig)
localizedXmlDocument
- A localized XML DocumentxmlFormat
- The XML format being indexed, for example adn or oai_dcxmlIndexerFieldsConfig
- The config, or null if not usedpublic XMLIndexer(String xmlString, String xmlFormat, XMLIndexerFieldsConfig xmlIndexerFieldsConfig) throws Exception
xmlString
- A valid XML stringxmlFormat
- The XML format being indexed, for example adn or oai_dcxmlIndexerFieldsConfig
- The config, or null if not used
Exception
- If errorpublic XMLIndexer(URL urlToXml, String xmlFormat, XMLIndexerFieldsConfig xmlIndexerFieldsConfig) throws Exception
urlToXml
- URL to an XML documentxmlFormat
- The XML format being indexed, for example adn or oai_dcxmlIndexerFieldsConfig
- The config, or null if not used
Exception
- If errorMethod Detail |
---|
public void setIndexDefaultAndStemsField(boolean indexDefaultAndStemsField) throws IllegalStateException
indexDefaultAndStemsField
- The value to assign indexDefaultAndStemsField.
IllegalStateException
- If called after method #indexFields has been calledpublic String getTitle() throws IllegalStateException
IllegalStateException
- If called prior to calling method #indexFieldspublic void setTitle(String title) throws IllegalStateException
title
- The value to assign title.
IllegalStateException
- If called after method #indexFields has been calledpublic String getDescription() throws IllegalStateException
IllegalStateException
- If called prior to calling method #indexFieldspublic void setDescription(String description) throws IllegalStateException
description
- The value to assign description.
IllegalStateException
- If called after method #indexFields has been calledpublic String[] getUrls() throws IllegalStateException
IllegalStateException
- If called prior to calling method #indexFieldspublic void setUrls(String[] urls) throws IllegalStateException
urls
- The value to assign urls.
IllegalStateException
- If called after method #indexFields has been calledpublic String[] getIds() throws IllegalStateException
IllegalStateException
- If called prior to calling method #indexFieldspublic void setIds(String[] ids) throws IllegalStateException
ids
- The value to assign ids.
IllegalStateException
- If called after method #indexFields has been calledpublic String[] getIdsEncoded() throws IllegalStateException
IllegalStateException
- If called prior to calling method #indexFieldsgetIds()
public List getRelatedIds() throws IllegalStateException
IllegalStateException
- If called prior to calling method #indexFieldspublic List getRelatedUrls() throws IllegalStateException
IllegalStateException
- If called prior to calling method #indexFieldspublic Map getRelatedIdsMap() throws IllegalStateException
IllegalStateException
- If called prior to calling method #indexFieldspublic Map getRelatedUrlsMap() throws IllegalStateException
IllegalStateException
- If called prior to calling method #indexFieldspublic String getXPathFieldsPrefix()
public void setXPathFieldsPrefix(String xPathFieldsPrefix) throws IllegalStateException
xPathFieldsPrefix
- The value to append to the xPath fields, or null for none
IllegalStateException
public BoundingBox getBoundingBox()
public void setBoundingBox(BoundingBox boundingBox)
boundingBox
- The value to assign boundingBox.public String getFullXmlElementContent() throws IllegalStateException
IllegalStateException
- If called prior to calling method #indexFieldspublic String getFullXmlAttributeContent() throws IllegalStateException
IllegalStateException
- If called prior to calling method #indexFieldspublic Document getXmlDocument()
public void indexFields(org.apache.lucene.document.Document luceneDoc) throws Exception
luceneDoc
- The Document
to add fields to
Exception
- If error, provides an appropriate message to display in indexing reports.public void indexXpathFields(org.apache.lucene.document.Document luceneDoc) throws Exception
luceneDoc
- The Document
to add fields to
Exception
- If error, provides an appropriate message to display in indexing reports.setXPathFieldsPrefix(java.lang.String)
public boolean indexJavaBeanFields(org.apache.lucene.document.Document luceneDoc) throws Exception
luceneDoc
- The Document
to add fields to
Exception
- If error, provides an appropriate message to display in indexing reports.
|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |