org.compass.core.mapping.xsem.builder
Class XmlMappingBuilder

java.lang.Object
  extended by org.compass.core.mapping.xsem.builder.XmlMappingBuilder
All Implemented Interfaces:
ResourceMappingProvider

public class XmlMappingBuilder
extends Object
implements ResourceMappingProvider

A builder allowing to constrcut xml mapping definition.

Author:
kimchy
See Also:
XSEM.xml(String)

Constructor Summary
XmlMappingBuilder(String alias)
          Constructs a new Xml mapping based on the specified alias.
 
Method Summary
 XmlMappingBuilder add(XmlAnalyzerMappingBuilder builder)
          Adds an xml analyzer property mapping definition.
 XmlMappingBuilder add(XmlBoostMappingBuilder builder)
          Adds an xml boost property mapping definition.
 XmlMappingBuilder add(XmlContentMappingBuilder builder)
          Adds an XML content mapping definition.
 XmlMappingBuilder add(XmlIdMappingBuilder builder)
          Adds an xml id mapping definition.
 XmlMappingBuilder add(XmlPropertyMappingBuilder builder)
          Adds an xml property mapping definition.
 XmlMappingBuilder all(XmlAllMappingBuilder allMappingBuilder)
          Sets the "all" level mapping definition.
 XmlMappingBuilder analyzer(String analyzer)
          The name of the analyzer that will be used to analyze ANALYZED properties.
 XmlMappingBuilder boost(float boost)
          Sets the boost value for the xml mapping.
 XmlMappingBuilder extendsAliases(String... extendedAliases)
          Sets the list of other xml mappings that this mapping will extend and inherit internal mappings from.
 ResourceMapping getMapping()
          Returns the mapping constructed.
 XmlMappingBuilder spellCheck(SpellCheck spellCheck)
          Sets the spell check mode that will be used for this xml mapping (and for all the internal mappings that do not explicitly set their own spell check mode).
 XmlMappingBuilder subIndex(String subIndex)
          Sets a sub index that will be used for this resource.
 XmlMappingBuilder subIndex(SubIndexHash subIndexHash)
          Sets a custom sub index hashing strategy for the resource mapping.
 XmlMappingBuilder xpath(String xpath)
          An optional xpath expression to narrow down the actual xml elements that will represent the top level xml object which will be mapped to the search engine.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlMappingBuilder

public XmlMappingBuilder(String alias)
Constructs a new Xml mapping based on the specified alias.

Method Detail

getMapping

public ResourceMapping getMapping()
Returns the mapping constructed. Used in CompassConfiguration.addMapping(org.compass.core.mapping.ResourceMappingProvider).

Specified by:
getMapping in interface ResourceMappingProvider

xpath

public XmlMappingBuilder xpath(String xpath)
An optional xpath expression to narrow down the actual xml elements that will represent the top level xml object which will be mapped to the search engine. A nice benefit here, is that the xpath can return multiple xml objects, which in turn will result in multiple Resources saved to the search engine.


subIndex

public XmlMappingBuilder subIndex(String subIndex)
Sets a sub index that will be used for this resource. Basically uses ConstantSubIndexHash.


subIndex

public XmlMappingBuilder subIndex(SubIndexHash subIndexHash)
Sets a custom sub index hashing strategy for the resource mapping.


extendsAliases

public XmlMappingBuilder extendsAliases(String... extendedAliases)
Sets the list of other xml mappings that this mapping will extend and inherit internal mappings from.


spellCheck

public XmlMappingBuilder spellCheck(SpellCheck spellCheck)
Sets the spell check mode that will be used for this xml mapping (and for all the internal mappings that do not explicitly set their own spell check mode). If not set will use the global spell check setting.


analyzer

public XmlMappingBuilder analyzer(String analyzer)
The name of the analyzer that will be used to analyze ANALYZED properties. Defaults to the default analyzer which is one of the internal analyzers that comes with Compass. If not set, will use the default analyzer.

Note, that when using the xml-analyzer mapping (a child mapping of xml mapping) (for an xml property value that controls the analyzer), the analyzer attribute will have no effects.


boost

public XmlMappingBuilder boost(float boost)
Sets the boost value for the xml mapping.


all

public XmlMappingBuilder all(XmlAllMappingBuilder allMappingBuilder)
Sets the "all" level mapping definition.


add

public XmlMappingBuilder add(XmlIdMappingBuilder builder)
Adds an xml id mapping definition.


add

public XmlMappingBuilder add(XmlPropertyMappingBuilder builder)
Adds an xml property mapping definition.


add

public XmlMappingBuilder add(XmlAnalyzerMappingBuilder builder)
Adds an xml analyzer property mapping definition.


add

public XmlMappingBuilder add(XmlBoostMappingBuilder builder)
Adds an xml boost property mapping definition.


add

public XmlMappingBuilder add(XmlContentMappingBuilder builder)
Adds an XML content mapping definition.



Copyright (c) 2004-2009 The Compass Project.