From 4e439e791e43adb89fcafbcb53cf6d25399fdeba Mon Sep 17 00:00:00 2001 From: Mark Robert Miller Date: Tue, 11 Dec 2012 00:06:56 +0000 Subject: [PATCH] SOLR-3948: Calculate/display deleted documents in admin interface. git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1419939 13f79535-47bb-0310-9956-ffa450edef68 --- solr/CHANGES.txt | 3 +++ .../org/apache/solr/handler/admin/LukeRequestHandler.java | 1 + .../src/java/org/apache/solr/search/SolrIndexSearcher.java | 1 + solr/webapp/web/js/scripts/cores.js | 3 +++ solr/webapp/web/js/scripts/dashboard.js | 1 + solr/webapp/web/tpl/cores.html | 5 +++++ solr/webapp/web/tpl/dashboard.html | 5 ++++- 7 files changed, 18 insertions(+), 1 deletion(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index ed4f6b9f63f..30e07edd882 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -128,6 +128,9 @@ New Features * SOLR-4028: When using ZK chroot, it would be nice if Solr would create the initial path when it doesn't exist. (Tomas Fernandez Lobbe via Mark Miller) +* SOLR-3948: Calculate/display deleted documents in admin interface. + (Shawn Heisey via Mark Miller) + Optimizations ---------------------- diff --git a/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java index cf47ca62e7c..4cd185448b6 100644 --- a/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java +++ b/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java @@ -547,6 +547,7 @@ public class LukeRequestHandler extends RequestHandlerBase indexInfo.add("numDocs", reader.numDocs()); indexInfo.add("maxDoc", reader.maxDoc()); + indexInfo.add("deletedDocs", reader.maxDoc() - reader.numDocs()); indexInfo.add("version", reader.getVersion()); // TODO? Is this different then: IndexReader.getCurrentVersion( dir )? indexInfo.add("segmentCount", reader.leaves().size()); diff --git a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java index 0116658cee9..b986d543440 100644 --- a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java +++ b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java @@ -1983,6 +1983,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable,SolrIn lst.add("caching", cachingEnabled); lst.add("numDocs", reader.numDocs()); lst.add("maxDoc", reader.maxDoc()); + lst.add("deletedDocs", reader.maxDoc() - reader.numDocs()); lst.add("reader", reader.toString()); lst.add("readerDir", reader.directory()); lst.add("indexVersion", reader.getVersion()); diff --git a/solr/webapp/web/js/scripts/cores.js b/solr/webapp/web/js/scripts/cores.js index 8c358c0255f..c60ea128ec5 100644 --- a/solr/webapp/web/js/scripts/cores.js +++ b/solr/webapp/web/js/scripts/cores.js @@ -199,6 +199,9 @@ sammy.get $( '.maxDoc dd', index_data_element ) .html( core_data.index.maxDoc ); + + $( '.deletedDocs dd', index_data_element ) + .html( core_data.index.deletedDocs ); $( '.optimized dd', index_data_element ) .addClass( !core_data.index.hasDeletions ? 'ico-1' : 'ico-0' ); diff --git a/solr/webapp/web/js/scripts/dashboard.js b/solr/webapp/web/js/scripts/dashboard.js index 3e5bc44a141..1bee7bc7833 100644 --- a/solr/webapp/web/js/scripts/dashboard.js +++ b/solr/webapp/web/js/scripts/dashboard.js @@ -114,6 +114,7 @@ sammy.get var data = { 'index_num-docs' : response['index']['numDocs'], 'index_max-doc' : response['index']['maxDoc'], + 'index_deleted-docs' : response['index']['deletedDocs'], 'index_version' : response['index']['version'], 'index_segmentCount' : response['index']['segmentCount'], 'index_last-modified' : response['index']['lastModified'] diff --git a/solr/webapp/web/tpl/cores.html b/solr/webapp/web/tpl/cores.html index 8260593cd44..45243c607c1 100644 --- a/solr/webapp/web/tpl/cores.html +++ b/solr/webapp/web/tpl/cores.html @@ -184,6 +184,11 @@ limitations under the License.
+
  • +
    deletedDocs:
    +
    +
  • +
  • optimized:
    diff --git a/solr/webapp/web/tpl/dashboard.html b/solr/webapp/web/tpl/dashboard.html index 66727c1132a..a79c1f2fb5e 100644 --- a/solr/webapp/web/tpl/dashboard.html +++ b/solr/webapp/web/tpl/dashboard.html @@ -39,6 +39,9 @@ limitations under the License.
    Max Doc:
    +
    Deleted Docs:
    +
    +
    Version:
    @@ -161,4 +164,4 @@ limitations under the License. - \ No newline at end of file +