You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "Aleksander M. Stensby" <al...@integrasco.no> on 2008/09/23 14:05:24 UTC

EmbeddedSolrServer and the MultiCore functionality

Hello everyone, I'm new to Solr (have been using Lucene for a few years  
now). We are looking into Solr and have heard many good things about the  
project:)

I have a few questions regarding the EmbeddedSolrServer in Solrj and the  
MultiCore features... I've tried to find answers to this in the archives  
but have not succeeded.
The thing is, I want to be able to use the Embedded server to access  
multiple cores on one machine, and I would like to at least have the  
possibility to access the lucene indexes without http. In particular I'm  
wondering if it is possible to do the "shards" (distributed search)  
approach using the embedded server, without using http requests.

lets say I register 2 cores to a container and init my embedded server  
like this:
             CoreContainer container = new CoreContainer();
             container.register("core1", core1, false);
             container.register("core2", core2, false);
             server = new EmbeddedSolrServer(container, "core1");
then queries performed on my server will return results from core1... and  
if i do ..=new EmbeddedSolrServer(container, "core2") the results will  
come from core2.

If i have solr up and running and do something like this:
             query.set("shards",  
"localhost:8080/solr/core0,localhost:8080/solr/core1");
I will get the results from both cores, obviously...

But is there a way to do this without using shards and accessing the cores  
through http?
I presume it would/should be possible to do the same thing directly  
against the cores, but my question is really if this has been implemented  
already / is it possible?


Thanks in advance for any replies!

Best regards,
  Aleksander


-- 
Aleksander M. Stensby
Senior Software Developer
Integrasco A/S
+47 41 22 82 72
aleksander.stensby@integrasco.no

Re: EmbeddedSolrServer and the MultiCore functionality

Posted by "Aleksander M. Stensby" <al...@integrasco.no>.
Okay, sounds fair.
Well, why I would have multiple shards was based on the presumption that  
it would be more effective to be able to search in single shards when  
needed (if each shard contains lets say 30 million entries) and then when  
time comes, migrate one of the shards to a different node. But I guess the  
gain in performance is not significant and that i should rather have just  
one shard per node. Or?

Best regards and thanks for your answer,
  Aleksander

On Tue, 23 Sep 2008 16:57:08 +0200, Ryan McKinley <ry...@gmail.com>  
wrote:

>>
>> If i have solr up and running and do something like this:
>>            query.set("shards", "localhost:8080/solr/core0,localhost: 
>> 8080/solr/core1");
>> I will get the results from both cores, obviously...
>>
>> But is there a way to do this without using shards and accessing the  
>> cores through http?
>> I presume it would/should be possible to do the same thing directly  
>> against the cores, but my question is really if this has been  
>> implemented already / is it possible?
>>
>
> not implemented...
>
> Check line 384 of SearchHandler.java
>    SolrServer server = new CommonsHttpSolrServer(url, client);
>
> it defaults to CommonsHttpSolrServer.
>
> This could easily change to EmbeddedSolrServer, but i'm not sure it is a  
> very common usecase...
>
> why would you have multiple shards on the same machine?
>
> ryan
>
>
>



-- 
Aleksander M. Stensby
Senior Software Developer
Integrasco A/S
+47 41 22 82 72
aleksander.stensby@integrasco.no

Re: EmbeddedSolrServer and the MultiCore functionality

Posted by Ryan McKinley <ry...@gmail.com>.
>
> If i have solr up and running and do something like this:
>            query.set("shards", "localhost:8080/solr/core0,localhost: 
> 8080/solr/core1");
> I will get the results from both cores, obviously...
>
> But is there a way to do this without using shards and accessing the  
> cores through http?
> I presume it would/should be possible to do the same thing directly  
> against the cores, but my question is really if this has been  
> implemented already / is it possible?
>

not implemented...

Check line 384 of SearchHandler.java
   SolrServer server = new CommonsHttpSolrServer(url, client);

it defaults to CommonsHttpSolrServer.

This could easily change to EmbeddedSolrServer, but i'm not sure it is  
a very common usecase...

why would you have multiple shards on the same machine?

ryan