org.mycore.services.fieldquery
Class MCRFieldDef

java.lang.Object
  extended by org.mycore.services.fieldquery.MCRFieldDef

public class MCRFieldDef
extends Object

A search field definition. For each field in the configuration file searchfields.xml there is one MCRFieldDef instance with attributes that represent the configuration in the xml file.

Author:
Frank Lützenkirchen

Field Summary
static Namespace extns
           
static String FILE_ADDITIONAL_DATA
          A keyword identifying that the source of the values of this field is the getAllAdditionalData() method of MCRFile
static String FILE_METADATA
          A keyword identifying that the source of the values of this field is the createXML() method of MCRFile
static String FILE_TEXT_CONTENT
          A keyword identifying that the source of the values of this field is the text content of the MCRFile, using text filter plug-ins.
static String FILE_XML_CONTENT
          A keyword identifying that the source of the values of this field is the XML content of the MCRFile
static String OBJECT_CATEGORY
          A keyword identifying that the source of the values of this field is a classification category that a MCRObject belongs to
static String OBJECT_METADATA
          A keyword identifying that the source of the values of this field is the createXML() method of MCRObject
static String SEARCHER_HIT_METADATA
          A keyword identifying that the source of the values of this field is the MCRSearcher that does the search, this means it is technical hit metadata added by the searcher when the query results are built.
static Namespace xalanns
           
static String XML
          A keyword identifying that the source of the values of this field is the XML content of a pure JDOM xml document
 
Constructor Summary
MCRFieldDef(String index, Element def)
           
 
Method Summary
static Element getConfigFile()
           
 String getDataType()
          Returns the data type of this field as defined in fieldtypes.xml
static MCRFieldDef getDef(String name)
          Returns the MCRFieldDef with the given name, or null if no such field is defined in searchfields.xml
static List<MCRFieldDef> getFieldDefs(String index)
          Returns all fields that belong to the given index
 String getIndex()
          Returns the ID of the index this field belongs to
 String getName()
          Returns the name of the field
 String getSource()
          Returns a keyword identifying where the values of this field come from.
(package private)  Element getXSL()
          Returns a stylesheet to build values for this field from XML source data
 boolean isAddable()
          Returns true if this field should be added by searcher to hit
 boolean isSortable()
          Returns true if this field can be used as sort criteria
 boolean isUsedForObjectType(String objectType)
          Returns true if this field is used for this type of object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xalanns

public static final Namespace xalanns

extns

public static final Namespace extns

OBJECT_METADATA

public static final String OBJECT_METADATA
A keyword identifying that the source of the values of this field is the createXML() method of MCRObject

See Also:
MCRObject.createXML(), Constant Field Values

OBJECT_CATEGORY

public static final String OBJECT_CATEGORY
A keyword identifying that the source of the values of this field is a classification category that a MCRObject belongs to

See Also:
MCRObject.createXML(), Constant Field Values

FILE_METADATA

public static final String FILE_METADATA
A keyword identifying that the source of the values of this field is the createXML() method of MCRFile

See Also:
MCRFile.createXML(), Constant Field Values

FILE_ADDITIONAL_DATA

public static final String FILE_ADDITIONAL_DATA
A keyword identifying that the source of the values of this field is the getAllAdditionalData() method of MCRFile

See Also:
MCRFilesystemNode.getAllAdditionalData(), Constant Field Values

FILE_XML_CONTENT

public static final String FILE_XML_CONTENT
A keyword identifying that the source of the values of this field is the XML content of the MCRFile

See Also:
MCRFile.getContentAsJDOM(), Constant Field Values

XML

public static final String XML
A keyword identifying that the source of the values of this field is the XML content of a pure JDOM xml document

See Also:
Constant Field Values

FILE_TEXT_CONTENT

public static final String FILE_TEXT_CONTENT
A keyword identifying that the source of the values of this field is the text content of the MCRFile, using text filter plug-ins.

See Also:
Constant Field Values

SEARCHER_HIT_METADATA

public static final String SEARCHER_HIT_METADATA
A keyword identifying that the source of the values of this field is the MCRSearcher that does the search, this means it is technical hit metadata added by the searcher when the query results are built.

See Also:
Constant Field Values
Constructor Detail

MCRFieldDef

public MCRFieldDef(String index,
                   Element def)
Method Detail

getConfigFile

public static Element getConfigFile()
Returns:
the searchfields-configuration file as jdom-element

getDef

public static MCRFieldDef getDef(String name)
Returns the MCRFieldDef with the given name, or null if no such field is defined in searchfields.xml

Parameters:
name - the name of the field
Returns:
the MCRFieldDef instance representing this field

getFieldDefs

public static List<MCRFieldDef> getFieldDefs(String index)
Returns all fields that belong to the given index

Parameters:
index - the ID of the index
Returns:
a List of MCRFieldDef objects for that index

getIndex

public String getIndex()
Returns the ID of the index this field belongs to

Returns:
the index ID

getName

public String getName()
Returns the name of the field

Returns:
the field's name

getDataType

public String getDataType()
Returns the data type of this field as defined in fieldtypes.xml

Returns:
the data type

isSortable

public boolean isSortable()
Returns true if this field can be used as sort criteria

Returns:
true, if field can be used to sort query results

isAddable

public boolean isAddable()
Returns true if this field should be added by searcher to hit

Returns:
true, if this field should be added by searcher to hit

isUsedForObjectType

public boolean isUsedForObjectType(String objectType)
Returns true if this field is used for this type of object. For MCRObject, the type is the same as in MCRObject.getId().getTypeId(). For MCRFile, the type is the same as in MCRFile.getContentTypeID(). For plain XML data, the type is the name of the root element.

Parameters:
objectType - the type of object

getSource

public String getSource()
Returns a keyword identifying where the values of this field come from.

See Also:
FILE_METADATA, FILE_TEXT_CONTENT, FILE_XML_CONTENT, OBJECT_METADATA, OBJECT_CATEGORY, SEARCHER_HIT_METADATA, XML

getXSL

Element getXSL()
Returns a stylesheet to build values for this field from XML source data