Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 058EA200CBE for ; Fri, 7 Jul 2017 21:44:24 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 04115169DF8; Fri, 7 Jul 2017 19:44:24 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id F0E8C169DF7 for ; Fri, 7 Jul 2017 21:44:22 +0200 (CEST) Received: (qmail 77107 invoked by uid 500); 7 Jul 2017 19:44:22 -0000 Mailing-List: contact commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list commits@lucene.apache.org Received: (qmail 77098 invoked by uid 99); 7 Jul 2017 19:44:22 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Jul 2017 19:44:22 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 0A2A0E04AA; Fri, 7 Jul 2017 19:44:22 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: varun@apache.org To: commits@lucene.apache.org Message-Id: <5b22fad0a20a484ab564ecdad89e4900@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: lucene-solr:branch_7x: 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 Date: Fri, 7 Jul 2017 19:44:22 +0000 (UTC) archived-at: Fri, 07 Jul 2017 19:44:24 -0000 Repository: lucene-solr Updated Branches: refs/heads/branch_7x 583438c2e -> e7f28d8f4 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/e7f28d8f Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/e7f28d8f Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/e7f28d8f Branch: refs/heads/branch_7x Commit: e7f28d8f4af08b28c64c306e1f76edee6372c886 Parents: 583438c Author: Varun Thacker Authored: Fri Jul 7 12:42:33 2017 -0700 Committer: Varun Thacker Committed: Fri Jul 7 12:43:48 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/e7f28d8f/solr/CHANGES.txt ---------------------------------------------------------------------- diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 57fcba0..4869211 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -460,6 +460,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/e7f28d8f/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 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 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/e7f28d8f/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 @@ - - - - - - - - http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e7f28d8f/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 d3425cd..3173b62 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 @@ string - elevate.xml http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e7f28d8f/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 @@ - - - - - - - - http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e7f28d8f/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 d3425cd..3173b62 100644 --- a/solr/server/solr/configsets/_default/conf/solrconfig.xml +++ b/solr/server/solr/configsets/_default/conf/solrconfig.xml @@ -1004,7 +1004,6 @@ string - elevate.xml