diff --git a/Drupal_Apache_Solr_Service.php b/Drupal_Apache_Solr_Service.php
index f3632f5..c953b7c 100644
--- a/Drupal_Apache_Solr_Service.php
+++ b/Drupal_Apache_Solr_Service.php
@@ -78,7 +78,8 @@ class DrupalApacheSolrService implements DrupalApacheSolrServiceInterface {
const SEARCH_SERVLET = 'select';
const LUKE_SERVLET = 'admin/luke';
const SYSTEM_SERVLET = 'admin/system';
- const STATS_SERVLET = 'admin/stats.jsp';
+ const STATS_CORE = 'admin/mbeans?wt=xml&stats=true&cat=CORE';
+ const STATS_UPDATEHANDLER = 'admin/mbeans?wt=xml&stats=true&cat=UPDATEHANDLER&key=updateHandler';
/**
* Server url
@@ -221,26 +222,41 @@ class DrupalApacheSolrService implements DrupalApacheSolrServiceInterface {
}
/**
- * Sets $this->stats with the information about the Solr Core form /admin/stats.jsp
+ * Sets $this->stats with the information about the Solr Core form
*/
protected function setStats() {
$data = $this->getLuke();
+ $this->stats_core = '';
+ $this->stats_updatehandler = '';
+
// Only try to get stats if we have connected to the index.
- if (empty($this->stats) && isset($data->index->numDocs)) {
- $url = $this->_constructUrl(self::STATS_SERVLET);
+ if (empty($this->stats_core) && isset($data->index->numDocs)) {
+ $url_core = $this->_constructUrl(self::STATS_CORE);
+ $url_updatehandler = $this->_constructUrl(self::STATS_UPDATEHANDLER);
if ($this->env_id) {
- $this->stats_cid = $this->env_id . ":stats:" . drupal_hash_base64($url);
- $cache = cache_get($this->stats_cid, 'cache_apachesolr');
- if (isset($cache->data)) {
- $this->stats = simplexml_load_string($cache->data);
+ $this->stats_core_cid = $this->env_id . ":stats_core:" . drupal_hash_base64($url_core);
+ $cache_core = cache_get($this->stats_core_cid, 'cache_apachesolr');
+
+ $this->stats_updatehandler_cid = $this->env_id . ":stats_updatehandler:" . drupal_hash_base64($url_updatehandler);
+ $cache_updatehandler = cache_get($this->stats_updatehandler_cid, 'cache_apachesolr');
+
+
+ if (isset($cache_core->data)) {
+ $this->stats_core = simplexml_load_string($cache_core->data);
+ }
+ if (isset($cache_updatehandler->data)) {
+ $this->stats_updatehandler = simplexml_load_string($cache_updatehandler->data);
}
}
// Second pass to populate the cache if necessary.
- if (empty($this->stats)) {
- $response = $this->_sendRawGet($url);
- $this->stats = simplexml_load_string($response->data);
+ if (empty($this->stats_core) || empty($this->stats_updatehandler)) {
+ $response_core = $this->_sendRawGet($url_core);
+ $response_updatehandler = $this->_sendRawGet($url_updatehandler);
+ $this->stats_core = simplexml_load_string($response_core->data);
+ $this->stats_updatehandler = simplexml_load_string($response_updatehandler->data);
if ($this->env_id) {
- cache_set($this->stats_cid, $response->data, 'cache_apachesolr');
+ cache_set($this->stats_core_cid, $response_core->data, 'cache_apachesolr');
+ cache_set($this->stats_updatehandler_cid, $response_updatehandler->data, 'cache_apachesolr');
}
}
}
@@ -251,18 +267,27 @@ class DrupalApacheSolrService implements DrupalApacheSolrServiceInterface {
*
* Returns a Simple XMl document
*/
- public function getStats() {
+ public function getStats($type = 'core') {
if (!isset($this->stats)) {
$this->setStats();
}
- return $this->stats;
+ switch ($type) {
+ case 'core':
+ return $this->stats_core;
+ break;
+ case 'updatehandler' :
+ return $this->stats_updatehandler;
+ break;
+ }
}
/**
* Get summary information about the Solr Core.
*/
public function getStatsSummary() {
- $stats = $this->getStats();
+ $stats_core = $this->getStats('core');
+ $stats_updatehandler = $this->getStats('updatehandler');
+
$summary = array(
'@pending_docs' => '',
'@autocommit_time_seconds' => '',
@@ -275,24 +300,24 @@ class DrupalApacheSolrService implements DrupalApacheSolrServiceInterface {
'@index_size' => '',
);
- if (!empty($stats)) {
- $docs_pending_xpath = $stats->xpath('//stat[@name="docsPending"]');
+ if (!empty($stats_core) && !empty($stats_updatehandler)) {
+ $docs_pending_xpath = $stats_updatehandler->xpath('//lst["stats"]/long[@name="docsPending"]');
$summary['@pending_docs'] = (int) trim(current($docs_pending_xpath));
- $max_time_xpath = $stats->xpath('//stat[@name="autocommit maxTime"]');
+ $max_time_xpath = $stats_updatehandler->xpath('//lst["stats"]/str[@name="autocommit maxTime"]');
$max_time = (int) trim(current($max_time_xpath));
// Convert to seconds.
$summary['@autocommit_time_seconds'] = $max_time / 1000;
$summary['@autocommit_time'] = format_interval($max_time / 1000);
- $deletes_id_xpath = $stats->xpath('//stat[@name="deletesById"]');
+ $deletes_id_xpath = $stats_updatehandler->xpath('//lst["stats"]/long[@name="deletesById"]');
$summary['@deletes_by_id'] = (int) trim(current($deletes_id_xpath));
- $deletes_query_xpath = $stats->xpath('//stat[@name="deletesByQuery"]');
+ $deletes_query_xpath = $stats_updatehandler->xpath('//lst["stats"]/long[@name="deletesByQuery"]');
$summary['@deletes_by_query'] = (int) trim(current($deletes_query_xpath));
$summary['@deletes_total'] = $summary['@deletes_by_id'] + $summary['@deletes_by_query'];
- $schema = $stats->xpath('/solr/schema[1]');
- $summary['@schema_version'] = trim($schema[0]);;
- $core = $stats->xpath('/solr/core[1]');
- $summary['@core_name'] = trim($core[0]);
- $size_xpath = $stats->xpath('//stat[@name="indexSize"]');
+ //$schema = $stats->xpath('/solr/schema[1]');
+ //$summary['@schema_version'] = trim($schema[0]);
+ $core = $stats_core->xpath('//lst["core"]/str[@name="coreName"]');
+ $summary['@core_name'] = trim(current($core));
+ $size_xpath = $stats_core->xpath('//lst["core"]/str[@name="indexSize"]');
$summary['@index_size'] = trim(current($size_xpath));
}
diff --git a/solr-conf/solr-4.x/protwords.txt b/solr-conf/solr-4.x/protwords.txt
new file mode 100644
index 0000000..f0fd084
--- /dev/null
+++ b/solr-conf/solr-4.x/protwords.txt
@@ -0,0 +1,8 @@
+#-----------------------------------------------------------------------
+# This file blocks words from being operated on by the stemmer and word delimiter.
+&
+<
+>
+'
+"
+
diff --git a/solr-conf/solr-4.x/schema.xml b/solr-conf/solr-4.x/schema.xml
new file mode 100644
index 0000000..2cebb36
--- /dev/null
+++ b/solr-conf/solr-4.x/schema.xml
@@ -0,0 +1,524 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id
+
+
+ content
+
+
+
+
+
diff --git a/solr-conf/solr-4.x/solrconfig.xml b/solr-conf/solr-4.x/solrconfig.xml
new file mode 100644
index 0000000..ee7949e
--- /dev/null
+++ b/solr-conf/solr-4.x/solrconfig.xml
@@ -0,0 +1,734 @@
+
+
+
+
+
+ LUCENE_40
+
+ ${solr.abortOnConfigurationError:true}
+
+
+
+
+
+
+ false
+
+ 10
+
+
+
+ 32
+ 2147483647
+ 20000
+ 1000
+ 10000
+
+
+
+
+
+
+
+
+
+
+ single
+
+
+ false
+ 32
+ 4
+ 2147483647
+ 20000
+
+
+ false
+
+
+
+
+ false
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2000
+ 120000
+
+
+
+
+
+
+
+
+
+
+
+
+ 1024
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+ 50
+
+
+ 200
+
+
+
+
+
+
+
+
+ solr 0 10
+ rocks 0 10
+ static newSearcher warming query from solrconfig.xml
+
+
+
+
+
+
+ fast_warm 0 10
+ static firstSearcher warming query from solrconfig.xml
+
+
+
+
+ false
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ explicit
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+ dismax
+ explicit
+ true
+
+
+
+
+
+
+ dismax
+ explicit
+ true
+ 0.01
+
+ content^2.0
+
+ 15
+
+
+ 1
+ *:*
+
+
+ true
+ content
+ 3
+ true
+
+ teaser
+ 256
+
+
+
+
+ false
+
+ true
+ false
+
+ 1
+
+
+ spellcheck
+
+
+
+
+
+
+ 1
+ 1
+ 3
+ 15
+ 20
+ false
+
+
+
+
+
+
+
+
+
+
+
+ textSpell
+
+
+ default
+ spell
+ ./spellchecker1
+ true
+
+
+ jarowinkler
+ spell
+
+ org.apache.lucene.search.spell.JaroWinklerDistance
+ ./spellchecker2
+ true
+
+
+
+
+
+
+
+
+
+ string
+ elevate.xml
+
+
+
+
+
+ explicit
+
+
+ elevator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ standard
+ solrpingquery
+ all
+
+
+
+
+
+
+ admin-extra.html
+ scripts.conf
+ xslt/example.xsl
+ xslt/example_atom.xsl
+ xslt/example_rss.xsl
+ xslt/luke.xsl
+
+
+
+
+
+
+ explicit
+ true
+
+
+
+
+
+
+
+
+ 100
+
+
+
+
+
+
+
+ 70
+
+ 0.5
+
+ [-\w ,/\n\"']{20,200}
+
+
+
+
+
+
+ ]]>
+ ]]>
+
+
+
+
+
+
+
+
+
+ 5
+
+
+
+
+
+
+
+
+
+ solr
+
+
+
+