You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by va...@apache.org on 2017/07/07 19:43:05 UTC
lucene-solr:master: SOLR-11021: The elevate.xml config-file is now
optional in the ElevationComponent. The default configset doesn't ship with
an elevate.xml file anymore
Repository: lucene-solr
Updated Branches:
refs/heads/master 14ec46c7f -> df3a9b353
SOLR-11021: The elevate.xml config-file is now optional in the ElevationComponent. The default configset doesn't ship with an elevate.xml file anymore
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/df3a9b35
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/df3a9b35
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/df3a9b35
Branch: refs/heads/master
Commit: df3a9b35313cb193025bbca9d2445bcb5acd6b90
Parents: 14ec46c
Author: Varun Thacker <va...@apache.org>
Authored: Fri Jul 7 12:42:33 2017 -0700
Committer: Varun Thacker <va...@apache.org>
Committed: Fri Jul 7 12:42:49 2017 -0700
----------------------------------------------------------------------
solr/CHANGES.txt | 3 +
.../component/QueryElevationComponent.java | 82 ++++++++++----------
.../solr/configsets/_default/conf/elevate.xml | 42 ----------
.../configsets/_default/conf/solrconfig.xml | 1 -
.../solr/configsets/_default/conf/elevate.xml | 42 ----------
.../configsets/_default/conf/solrconfig.xml | 1 -
6 files changed, 43 insertions(+), 128 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/df3a9b35/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index c562a85..8d0142e 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -477,6 +477,9 @@ Other Changes
* SOLR-11016: Fix TestCloudJSONFacetJoinDomain test-only bug (hossman)
+* SOLR-11021: The elevate.xml config-file is made optional in the ElevationComponent.
+ The default configset doesn't ship with a elevate.xml file anymore (Varun Thacker)
+
================== 6.7.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/df3a9b35/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java b/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java
index 3f3dd5c..6511c67 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java
@@ -204,53 +204,51 @@ public class QueryElevationComponent extends SearchComponent implements SolrCore
}
core.addTransformerFactory(markerName, elevatedMarkerFactory);
forceElevation = initArgs.getBool(QueryElevationParams.FORCE_ELEVATION, forceElevation);
- try {
- synchronized (elevationCache) {
- elevationCache.clear();
- String f = initArgs.get(CONFIG_FILE);
- if (f == null) {
- throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
- "QueryElevationComponent must specify argument: '" + CONFIG_FILE
- + "' -- path to elevate.xml");
- }
- boolean exists = false;
- // check if using ZooKeeper
- ZkController zkController = core.getCoreContainer().getZkController();
- if (zkController != null) {
- // TODO : shouldn't have to keep reading the config name when it has been read before
- exists = zkController.configFileExists(zkController.getZkStateReader().readConfigName(core.getCoreDescriptor().getCloudDescriptor().getCollectionName()), f);
- } else {
- File fC = new File(core.getResourceLoader().getConfigDir(), f);
- File fD = new File(core.getDataDir(), f);
- if (fC.exists() == fD.exists()) {
- throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
- "QueryElevationComponent missing config file: '" + f + "\n"
- + "either: " + fC.getAbsolutePath() + " or " + fD.getAbsolutePath() + " must exist, but not both.");
- }
- if (fC.exists()) {
- exists = true;
- log.info("Loading QueryElevation from: " + fC.getAbsolutePath());
- Config cfg = new Config(core.getResourceLoader(), f);
- elevationCache.put(null, loadElevationMap(cfg));
+ String f = initArgs.get(CONFIG_FILE);
+ if (f != null) {
+ try {
+ synchronized (elevationCache) {
+ elevationCache.clear();
+ boolean exists = false;
+
+ // check if using ZooKeeper
+ ZkController zkController = core.getCoreContainer().getZkController();
+ if (zkController != null) {
+ // TODO : shouldn't have to keep reading the config name when it has been read before
+ exists = zkController.configFileExists(zkController.getZkStateReader().readConfigName(core.getCoreDescriptor().getCloudDescriptor().getCollectionName()), f);
+ } else {
+ File fC = new File(core.getResourceLoader().getConfigDir(), f);
+ File fD = new File(core.getDataDir(), f);
+ if (fC.exists() == fD.exists()) {
+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
+ "QueryElevationComponent missing config file: '" + f + "\n"
+ + "either: " + fC.getAbsolutePath() + " or " + fD.getAbsolutePath() + " must exist, but not both.");
+ }
+ if (fC.exists()) {
+ exists = true;
+ log.info("Loading QueryElevation from: " + fC.getAbsolutePath());
+ Config cfg = new Config(core.getResourceLoader(), f);
+ elevationCache.put(null, loadElevationMap(cfg));
+ }
}
- }
- //in other words, we think this is in the data dir, not the conf dir
- if (!exists) {
- // preload the first data
- RefCounted<SolrIndexSearcher> searchHolder = null;
- try {
- searchHolder = core.getNewestSearcher(false);
- IndexReader reader = searchHolder.get().getIndexReader();
- getElevationMap(reader, core);
- } finally {
- if (searchHolder != null) searchHolder.decref();
+ //in other words, we think this is in the data dir, not the conf dir
+ if (!exists) {
+ // preload the first data
+ RefCounted<SolrIndexSearcher> searchHolder = null;
+ try {
+ searchHolder = core.getNewestSearcher(false);
+ IndexReader reader = searchHolder.get().getIndexReader();
+ getElevationMap(reader, core);
+ } finally {
+ if (searchHolder != null) searchHolder.decref();
+ }
}
}
+ } catch (Exception ex) {
+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
+ "Error initializing QueryElevationComponent.", ex);
}
- } catch (Exception ex) {
- throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
- "Error initializing QueryElevationComponent.", ex);
}
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/df3a9b35/solr/core/src/test-files/solr/configsets/_default/conf/elevate.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/configsets/_default/conf/elevate.xml b/solr/core/src/test-files/solr/configsets/_default/conf/elevate.xml
deleted file mode 100644
index 2c09ebe..0000000
--- a/solr/core/src/test-files/solr/configsets/_default/conf/elevate.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- If this file is found in the config directory, it will only be
- loaded once at startup. If it is found in Solr's data
- directory, it will be re-loaded every commit.
-
- See http://wiki.apache.org/solr/QueryElevationComponent for more info
-
--->
-<elevate>
- <!-- Query elevation examples
- <query text="foo bar">
- <doc id="1" />
- <doc id="2" />
- <doc id="3" />
- </query>
-
-for use with techproducts example
-
- <query text="ipod">
- <doc id="MA147LL/A" /> put the actual ipod at the top
- <doc id="IW-02" exclude="true" /> exclude this cable
- </query>
--->
-
-</elevate>
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/df3a9b35/solr/core/src/test-files/solr/configsets/_default/conf/solrconfig.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/configsets/_default/conf/solrconfig.xml b/solr/core/src/test-files/solr/configsets/_default/conf/solrconfig.xml
index f53636f..aa1ae69 100644
--- a/solr/core/src/test-files/solr/configsets/_default/conf/solrconfig.xml
+++ b/solr/core/src/test-files/solr/configsets/_default/conf/solrconfig.xml
@@ -1004,7 +1004,6 @@
<searchComponent name="elevator" class="solr.QueryElevationComponent" >
<!-- pick a fieldType to analyze queries -->
<str name="queryFieldType">string</str>
- <str name="config-file">elevate.xml</str>
</searchComponent>
<!-- A request handler for demonstrating the elevator component -->
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/df3a9b35/solr/server/solr/configsets/_default/conf/elevate.xml
----------------------------------------------------------------------
diff --git a/solr/server/solr/configsets/_default/conf/elevate.xml b/solr/server/solr/configsets/_default/conf/elevate.xml
deleted file mode 100644
index 2c09ebe..0000000
--- a/solr/server/solr/configsets/_default/conf/elevate.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- If this file is found in the config directory, it will only be
- loaded once at startup. If it is found in Solr's data
- directory, it will be re-loaded every commit.
-
- See http://wiki.apache.org/solr/QueryElevationComponent for more info
-
--->
-<elevate>
- <!-- Query elevation examples
- <query text="foo bar">
- <doc id="1" />
- <doc id="2" />
- <doc id="3" />
- </query>
-
-for use with techproducts example
-
- <query text="ipod">
- <doc id="MA147LL/A" /> put the actual ipod at the top
- <doc id="IW-02" exclude="true" /> exclude this cable
- </query>
--->
-
-</elevate>
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/df3a9b35/solr/server/solr/configsets/_default/conf/solrconfig.xml
----------------------------------------------------------------------
diff --git a/solr/server/solr/configsets/_default/conf/solrconfig.xml b/solr/server/solr/configsets/_default/conf/solrconfig.xml
index f53636f..aa1ae69 100644
--- a/solr/server/solr/configsets/_default/conf/solrconfig.xml
+++ b/solr/server/solr/configsets/_default/conf/solrconfig.xml
@@ -1004,7 +1004,6 @@
<searchComponent name="elevator" class="solr.QueryElevationComponent" >
<!-- pick a fieldType to analyze queries -->
<str name="queryFieldType">string</str>
- <str name="config-file">elevate.xml</str>
</searchComponent>
<!-- A request handler for demonstrating the elevator component -->