本文整理汇总了Java中org.apache.solr.core.Config类的典型用法代码示例。如果您正苦于以下问题:Java Config类的具体用法?Java Config怎么用?Java Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Config类属于org.apache.solr.core包,在下文中一共展示了Config类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: SolrRequestParsers
import org.apache.solr.core.Config; //导入依赖的package包/类
/**
* Pass in an xml configuration. A null configuration will enable
* everything with maximum values.
*/
public SolrRequestParsers( Config globalConfig ) {
final int multipartUploadLimitKB, formUploadLimitKB;
if( globalConfig == null ) {
multipartUploadLimitKB = formUploadLimitKB = Integer.MAX_VALUE;
enableRemoteStreams = true;
handleSelect = true;
} else {
multipartUploadLimitKB = globalConfig.getInt(
"requestDispatcher/requestParsers/@multipartUploadLimitInKB", 2048 );
formUploadLimitKB = globalConfig.getInt(
"requestDispatcher/requestParsers/@formdataUploadLimitInKB", 2048 );
enableRemoteStreams = globalConfig.getBool(
"requestDispatcher/requestParsers/@enableRemoteStreaming", false );
// Let this filter take care of /select?xxx format
handleSelect = globalConfig.getBool(
"requestDispatcher/@handleSelect", true );
}
init(multipartUploadLimitKB, formUploadLimitKB);
}
开发者ID:pkarmstr,项目名称:NYBC,代码行数:27,代码来源:SolrRequestParsers.java
示例2: bootstrapConf
import org.apache.solr.core.Config; //导入依赖的package包/类
/**
* If in SolrCloud mode, upload config sets for each SolrCore in solr.xml.
*/
public static void bootstrapConf(SolrZkClient zkClient, Config cfg, String solrHome) throws IOException,
KeeperException, InterruptedException {
log.info("bootstraping config into ZooKeeper using solr.xml");
NodeList nodes = (NodeList)cfg.evaluate("solr/cores/core", XPathConstants.NODESET);
for (int i=0; i<nodes.getLength(); i++) {
Node node = nodes.item(i);
String rawName = DOMUtil.substituteProperty(DOMUtil.getAttr(node, "name", null), new Properties());
String instanceDir = DOMUtil.getAttr(node, "instanceDir", null);
File idir = new File(instanceDir);
if (!idir.isAbsolute()) {
idir = new File(solrHome, instanceDir);
}
String confName = DOMUtil.substituteProperty(DOMUtil.getAttr(node, "collection", null), new Properties());
if (confName == null) {
confName = rawName;
}
File udir = new File(idir, "conf");
log.info("Uploading directory " + udir + " with name " + confName + " for SolrCore " + rawName);
ZkController.uploadConfigDir(zkClient, udir, confName);
}
}
开发者ID:pkarmstr,项目名称:NYBC,代码行数:26,代码来源:ZkController.java
示例3: main
import org.apache.solr.core.Config; //导入依赖的package包/类
public static void main(String[] args)
{
boolean isSolrCloud = true;
System.setProperty("solr.solr.home", SOLRHOME);
try {
Config config = new Config(null, SOLRHOME + "/" + CORENAME + "/conf/" +CONFFILE);
CategorizationValidation validation= new CategorizationValidation(SOLRHOME, CORENAME, ZKHOSTPORT, isSolrCloud);
// if(validation.validate(config))
{
if(isSolrCloud){
ZooKeeper zooKeeper = new ZooKeeper(ZKHOSTPORT, 3000, null);
zooKeeper.setData("/configs/"+CONFNAME_ZOOKEEPER+"/"+CONFFILE, Files.toByteArray(new File(SOLRHOME + "/" + CORENAME + "/conf/" +CONFFILE)), -1);
validation.reloadConfiguration();
}
else {
validation.reloadConfiguration();
}
}
// else {
// System.err.println(CONFFILE + " can not be validated!");
// }
} catch (Exception e) {
// TODO: handle exception
}
}
开发者ID:BassJel,项目名称:Jouve-Project,代码行数:27,代码来源:Executor.java
示例4: parseConfiguredVersion
import org.apache.solr.core.Config; //导入依赖的package包/类
private Version parseConfiguredVersion(String configuredVersion, String pluginClassName) {
Version version = (configuredVersion != null) ?
Config.parseLuceneVersionString(configuredVersion) : schema.getDefaultLuceneMatchVersion();
if (!version.onOrAfter(Version.LUCENE_4_0_0_ALPHA)) {
log.warn(pluginClassName + " is using deprecated " + version +
" emulation. You should at some point declare and reindex to at least 4.0, because " +
"3.x emulation is deprecated and will be removed in 5.0");
}
return version;
}
开发者ID:europeana,项目名称:search,代码行数:12,代码来源:FieldTypePluginLoader.java
示例5: parseConfiguredVersion
import org.apache.solr.core.Config; //导入依赖的package包/类
private Version parseConfiguredVersion(String configuredVersion, String pluginClassName) {
Version version = (configuredVersion != null) ?
Config.parseLuceneVersionString(configuredVersion) : schema.getDefaultLuceneMatchVersion();
if (!version.onOrAfter(Version.LUCENE_40)) {
log.warn(pluginClassName + " is using deprecated " + version +
" emulation. You should at some point declare and reindex to at least 4.0, because " +
"3.x emulation is deprecated and will be removed in 5.0");
}
return version;
}
开发者ID:pkarmstr,项目名称:NYBC,代码行数:12,代码来源:FieldTypePluginLoader.java
示例6: validate
import org.apache.solr.core.Config; //导入依赖的package包/类
public boolean validate(Config config){
loadCategorization(config);
for (Categorization categorization : categorizations) {
String destField = categorization.getDestField();
if (destField != null && !destField.isEmpty() && validateFieldExist(destField)) {
for (CategorizationRule categorizationRule : categorization.getCategorizationRules()) {
String srcField = categorizationRule.getSrcField();
if (srcField != null && !srcField.isEmpty() && validateFieldExist(destField)) {
if(!validateFieldTypeMatched(destField, categorizationRule.getMatchRegexpIndexedValues())){
System.err.println("matchRegexpIndexedValues is not compatible with destField in the rule with Values[srcField,regex]="+categorizationRule.getSrcField()+","+categorizationRule.getMatchRegexp()+" of the categorization "+categorization.getName());
return false;
}
}
else {
System.err.println("srcField is not valid in the rule with Values[srcField,regex]="+categorizationRule.getSrcField()+","+categorizationRule.getMatchRegexp()+" of the categorization "+categorization.getName());
return false;
}
}
}
else {
System.err.println("destField is not valid in the categorization "+categorization.getName());
return false;
}
}
return true;
}
开发者ID:BassJel,项目名称:Jouve-Project,代码行数:28,代码来源:CategorizationValidation.java
示例7: loadQLTBMap
import org.apache.solr.core.Config; //导入依赖的package包/类
/**
* Load the QLTB map from a Config.
*
* Read and process the "boosts/query" XPath nodes from the given
* Config, and build them into a QLTB map. The XML format is described
* in the class documentation.
*
* The result of this function is a map of (analyzed) query strings
* with their respective lists of boosted query terms. These are
* ConstantScoreQuery instances for each term with the corresponding
* boost factor. (Invalid - i.e. non-numerical - boost factors are
* logged as warnings).
*
* The SOLR core that is passed into this function is necessary for
* determinating the FieldType of the boosted fields. Only with the
* correct field type is it possible to boost non-string fields, as
* these non-string values need to be ft.readableToIndexed().
*
* @param cfg
* Config object to read the XML QLTB from
* @param core
* SOLR Core the query is performed on
* @return QLTB map
*
* @throws IOException
* If the query could not be analysed
*/
private Map<String, List<Query>> loadQLTBMap(final Config cfg, final SolrCore core) throws IOException {
Map<String, List<Query>> map = new HashMap<String, List<Query>>();
NodeList nodes = (NodeList) cfg.evaluate("boosts/query", XPathConstants.NODESET);
for (int i = 0; i < nodes.getLength(); i++) {
Node node = nodes.item(i);
String qstr = DOMUtil.getAttr(node, "text", "missing query 'text'");
qstr = getAnalyzedQuery(qstr);
NodeList children = node.getChildNodes();
List<Query> termBoosts = new ArrayList<Query>();
for (int j = 0; j < children.getLength(); j++) {
Node child = children.item(j);
if (!child.getNodeName().equals("term")) {
continue;
}
String field = DOMUtil.getAttr(child, "field", "missing 'field'");
String value = DOMUtil.getAttr(child, "value", "missing 'value'");
String boost = DOMUtil.getAttr(child, "boost", "missing 'boost'");
float termBoost = 1;
try {
termBoost = Float.parseFloat(boost);
} catch (NumberFormatException e) {
log.warn(
"invalid boost " + boost + " for query \"" + qstr
+ "\", term: \"" + field + ":" + value + "\": "
+ e.getMessage()
);
continue;
}
// without readableToIndexed QLTB boosting would only work
// for string field types
FieldType ft = core.getLatestSchema().getField(field).getType();
value = ft.readableToIndexed(value);
Term t = new Term(field, value);
TermQuery tq = new TermQuery(t);
ConstantScoreQuery csq = new ConstantScoreQuery(tq);
csq.setBoost(termBoost);
termBoosts.add(csq);
}
map.put(qstr, termBoosts);
}
return map;
}
开发者ID:solute,项目名称:qltb,代码行数:70,代码来源:QLTBComponent.java
注:本文中的org.apache.solr.core.Config类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论