Package org.apache.solr.core
Class Config
- java.lang.Object
-
- org.apache.solr.core.Config
-
- Direct Known Subclasses:
SolrConfig
public class Config extends Object
-
-
Constructor Summary
Constructors Constructor Description Config(SolrResourceLoader loader, String name)
Builds a config from a resource name with no xpath prefix.Config(SolrResourceLoader loader, String name, Document doc)
Config(SolrResourceLoader loader, String name, InputSource is, String prefix)
Config(SolrResourceLoader loader, String name, InputSource is, String prefix, boolean substituteProps)
Builds a config:
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
assertWarnOrFail(String reason, boolean assertCondition, boolean failCondition)
void
complainAboutUnknownAttributes(String elementXpath, String... knownAttributes)
Logs an error and throws an exception if any of the element(s) at the given elementXpath contains an attribute name that is not among knownAttributes.Object
evaluate(String path, QName type)
String
get(String path)
String
get(String path, String def)
boolean
getBool(String path)
boolean
getBool(String path, boolean def)
Document
getDocument()
double
getDouble(String path)
double
getDouble(String path, double def)
float
getFloat(String path)
float
getFloat(String path, float def)
int
getInt(String path)
int
getInt(String path, int def)
org.apache.lucene.util.Version
getLuceneVersion(String path)
org.apache.lucene.util.Version
getLuceneVersion(String path, org.apache.lucene.util.Version def)
String
getName()
Node
getNode(String path, boolean errifMissing)
Node
getNode(String path, Document doc, boolean errIfMissing)
NodeList
getNodeList(String path, boolean errIfMissing)
Config
getOriginalConfig()
SolrResourceLoader
getResourceLoader()
String
getResourceName()
protected Properties
getSubstituteProperties()
Set<String>
getUnknownAttributes(Element element, String... knownAttributes)
Returns the set of attributes on the given element that are not among the given knownAttributes, or null if all attributes are known.Node
getUnsubstitutedNode(String path, boolean errIfMissing)
String
getVal(String path, boolean errIfMissing)
XPath
getXPath()
int
getZnodeVersion()
If this config is loaded from zk the version is relevant other wise -1 is returnedstatic org.apache.lucene.util.Version
parseLuceneVersionString(String matchVersion)
void
substituteProperties()
-
-
-
Constructor Detail
-
Config
public Config(SolrResourceLoader loader, String name) throws ParserConfigurationException, IOException, SAXException
Builds a config from a resource name with no xpath prefix.
-
Config
public Config(SolrResourceLoader loader, String name, InputSource is, String prefix) throws ParserConfigurationException, IOException, SAXException
-
Config
public Config(SolrResourceLoader loader, String name, InputSource is, String prefix, boolean substituteProps) throws ParserConfigurationException, IOException, SAXException
Builds a config:Note that the 'name' parameter is used to obtain a valid input stream if no valid one is provided through 'is'. If no valid stream is provided, a valid SolrResourceLoader instance should be provided through 'loader' so the resource can be opened (@see SolrResourceLoader#openResource); if no SolrResourceLoader instance is provided, a default one will be created.
Consider passing a non-null 'name' parameter in all use-cases since it is used for logging & exception reporting.
- Parameters:
loader
- the resource loader used to obtain an input stream if 'is' is nullname
- the resource name used if the input stream 'is' is nullis
- the resource as a SAX InputSourceprefix
- an optional prefix that will be prepended to all non-absolute xpath expressions- Throws:
ParserConfigurationException
IOException
SAXException
-
Config
public Config(SolrResourceLoader loader, String name, Document doc)
-
-
Method Detail
-
assertWarnOrFail
public static void assertWarnOrFail(String reason, boolean assertCondition, boolean failCondition)
-
getSubstituteProperties
protected Properties getSubstituteProperties()
-
getResourceLoader
public SolrResourceLoader getResourceLoader()
- Since:
- solr 1.3
-
getResourceName
public String getResourceName()
- Since:
- solr 1.3
-
getName
public String getName()
-
getDocument
public Document getDocument()
-
getXPath
public XPath getXPath()
-
substituteProperties
public void substituteProperties()
-
getUnknownAttributes
public Set<String> getUnknownAttributes(Element element, String... knownAttributes)
Returns the set of attributes on the given element that are not among the given knownAttributes, or null if all attributes are known.
-
complainAboutUnknownAttributes
public void complainAboutUnknownAttributes(String elementXpath, String... knownAttributes)
Logs an error and throws an exception if any of the element(s) at the given elementXpath contains an attribute name that is not among knownAttributes.
-
getInt
public int getInt(String path)
-
getInt
public int getInt(String path, int def)
-
getBool
public boolean getBool(String path)
-
getBool
public boolean getBool(String path, boolean def)
-
getFloat
public float getFloat(String path)
-
getFloat
public float getFloat(String path, float def)
-
getDouble
public double getDouble(String path)
-
getDouble
public double getDouble(String path, double def)
-
getLuceneVersion
public org.apache.lucene.util.Version getLuceneVersion(String path)
-
getLuceneVersion
public org.apache.lucene.util.Version getLuceneVersion(String path, org.apache.lucene.util.Version def)
-
parseLuceneVersionString
public static final org.apache.lucene.util.Version parseLuceneVersionString(String matchVersion)
-
getZnodeVersion
public int getZnodeVersion()
If this config is loaded from zk the version is relevant other wise -1 is returned
-
getOriginalConfig
public Config getOriginalConfig()
-
-