lucene-ruby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: quick jruby + solr benchmarks
Date Wed, 26 Nov 2008 08:28:33 GMT
just a couple of quick code comments...

On Nov 25, 2008, at 6:04 PM, Matt Mitchell wrote:
> # EmbeddedSolrServer
> def embedded(solr_home)
>  @embedded ||= (
>    import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer
>    import org.apache.solr.core.CoreContainer
>    import org.apache.solr.core.CoreDescriptor
>    import org.apache.solr.client.solrj.SolrQuery
>    core_name = 'main-core'
>    container = CoreContainer.new
>    descriptor = CoreDescriptor.new(container, core_name, solr_home)
>    core = container.create(descriptor)

You'll want to close that core, otherwise the JVM doesn't exit.  I  
changed this to:

   @core = ....

>    container.register(core_name, core, false)

and used @core there.

> query = {'qt' => 'standard', 'q'=>'ipod', 'facet.field' => 'cat'}

Note that faceting is not enabled unless there is also a &facet=on

> params = hash_to_params(query)
>
> max = 1000
>
> Benchmark.bm do |x|
>  x.report 'http commons' do
>    max.times do
>      http_commons.query(params)
>    end
>  end
>  x.report 'embedded' do
>    max.times do
>      embedded(solr_home).query(params)
>    end
>  end
> end

And I added an:

   @core.close

at the end.

	Erik


Mime
View raw message