The stats.jsp page walks the internal JMX beans. It prints out the
numbers of documents among other things. I would look at how that
works instead of writing your own thing for the internal APIs.

They may have changed from Solr 1.3 to 1.4 and will change further for
1.5 (4.0 is the new name?).

On Tue, May 25, 2010 at 7:11 AM, Rahul R <rahul.s...@gmail.com> wrote:
> Chris,
> I am using SolrIndexSearcher to get a handle to the total number of records
> in the index. I am doing it like this :
> int num =
> Integer.parseInt((String)solrSearcher.getStatistics().get("numDocs").toString());
> Please let me know if there is a better way to do this.
>
> Mark,
> I can tell you what I do in my applicaiton. We provide a tool to do the
> index update and assume that the user will always use it to create/update
> the index. Whenever an update happens, we notify the querying application
> and it creates a new instance of SolrCore, SolrServer etc. These continue to
> be shared across multiple users (as statics) till the next update happens.
>
> Thank you.
>
> Regards
> Rahul
>
> On Tue, May 25, 2010 at 4:18 AM, Chris Hostetter
> <hossman_luc...@fucit.org>wrote:
>
>>
>> : Thank you.... I found the API to get the existing SolrIndexSearcher to be
>> : present in SolrCore:
>> : SolrCore.getSearcher().get()
>>
>> I think perhaps you need to take 5 big steps back and explain what your
>> goal is.  99.999% of all solr users should never care about that method --
>> even the 99.9% of the folks writing java code and using "EmbeddedSolr"
>> should never ever have a need to call those -- so what exactly is it you
>> are doing, and how did you get along hte path you find yourself on?
>>
>> this thread started with some fairly innoculous questions about how caches
>> worked in regardes to new searchers -- which is all fine and dandy, those
>> concepts that solr users should be aware of ... in the abstract.  you
>> should almost never be instantiating those IndexSearchers or Caches
>> yourself.
>>
>> Stick with teh SolrServer abstraction provided by SolrJ...
>>
>> http://wiki.apache.org/solr/Solrj#EmbeddedSolrServer
>>
>> http://lucene.apache.org/solr/api/org/apache/solr/client/solrj/SolrServer.html
>>
>>
>> -Hoss
>>
>>
>



-- 
Lance Norskog
goks...@gmail.com

Reply via email to