You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by yo...@apache.org on 2006/02/23 22:11:04 UTC
svn commit: r380224 - in /incubator/solr/trunk/src/java/org/apache/solr:
core/SolrCore.java search/SolrIndexSearcher.java
Author: yonik
Date: Thu Feb 23 13:11:01 2006
New Revision: 380224
URL: http://svn.apache.org/viewcvs?rev=380224&view=rev
Log:
add statistics for SolrIndexSearcher so we can remove the last reason for having the long outdated solar-status page
Modified:
incubator/solr/trunk/src/java/org/apache/solr/core/SolrCore.java
incubator/solr/trunk/src/java/org/apache/solr/search/SolrIndexSearcher.java
Modified: incubator/solr/trunk/src/java/org/apache/solr/core/SolrCore.java
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/java/org/apache/solr/core/SolrCore.java?rev=380224&r1=380223&r2=380224&view=diff
==============================================================================
--- incubator/solr/trunk/src/java/org/apache/solr/core/SolrCore.java (original)
+++ incubator/solr/trunk/src/java/org/apache/solr/core/SolrCore.java Thu Feb 23 13:11:01 2006
@@ -568,7 +568,6 @@
_searcher = newSearcherHolder;
SolrIndexSearcher newSearcher = newSearcherHolder.get();
- SolrInfoRegistry.getRegistry().put("currentSearcher", newSearcher);
newSearcher.register(); // register subitems (caches)
log.info("Registered new searcher " + newSearcher);
Modified: incubator/solr/trunk/src/java/org/apache/solr/search/SolrIndexSearcher.java
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/java/org/apache/solr/search/SolrIndexSearcher.java?rev=380224&r1=380223&r2=380224&view=diff
==============================================================================
--- incubator/solr/trunk/src/java/org/apache/solr/search/SolrIndexSearcher.java (original)
+++ incubator/solr/trunk/src/java/org/apache/solr/search/SolrIndexSearcher.java Thu Feb 23 13:11:01 2006
@@ -58,6 +58,8 @@
private final IndexSchema schema;
private final String name;
+ private long openTime = System.currentTimeMillis();
+ private long registerTime = 0;
private final IndexSearcher searcher;
private final IndexReader reader;
private final boolean closeReader;
@@ -134,6 +136,9 @@
cacheMap = noGenericCaches;
cacheList= noCaches;
}
+
+ // register self
+ SolrInfoRegistry.getRegistry().put(this.name, this);
}
@@ -149,10 +154,14 @@
cache.setState(SolrCache.State.LIVE);
SolrInfoRegistry.getRegistry().put(cache.name(), cache);
}
+ registerTime=System.currentTimeMillis();
}
public void close() throws IOException {
+ // unregister first, so no management actions are tried on a closing searcher.
+ SolrInfoRegistry.getRegistry().remove(name);
+
if (cachingEnabled) {
StringBuilder sb = new StringBuilder();
sb.append("Closing ").append(name);
@@ -1046,7 +1055,7 @@
}
public String getDescription() {
- return "the searcher that handles all index queries";
+ return "index searcher";
}
public Category getCategory() {
@@ -1070,22 +1079,18 @@
}
public NamedList getStatistics() {
- /***
NamedList lst = new NamedList();
- lst.add("requests", numRequests);
- lst.add("errors", numErrors);
+ lst.add("caching", cachingEnabled);
+ lst.add("numDocs", reader.numDocs());
+ lst.add("maxDoc", reader.maxDoc());
+ lst.add("readerImpl", reader.getClass().getSimpleName());
+ lst.add("readerDir", reader.directory());
+ lst.add("indexVersion", reader.getVersion());
+ lst.add("openedAt", new Date(openTime));
+ if (registerTime!=0) lst.add("registeredAt", new Date(registerTime));
return lst;
- ***/
- return new NamedList();
}
-
-
-
-
}
-
-
-
// Todo: counting only hit collector (for speed comparison w/ caching filters)