Hello,

I'm not sure what the best way is to do this, but I have done something
identical.

I have the same requirements, ie several datasources. I also used SolrJ and
jsp for this. The way I ended up doing it was to create a multi core
environment, one core per datasource. When I do a query across several
datasources, I use shards. Solr automatically returns a "hybrid" result set
that way, sorted by solr's default scoring.

Faceting comes in the picture when you want to show the number of documents
per datasource and have the ability to narrow down the result set. The way I
did it was to add a field called "dataSource" to all the documents, and
injected them with a default value of the data source name (in your case,
D1, D2 ...). You can do this by adding this in the schema:

<field name="dataSource" type="string" indexed="true" stored="true"
required="true" default="D1"/> 

When you perform a query across multiple datasources, you will use shards.
Here is an example:

http://localhost:8080/solr/core1/select?shards=localhost:8080/solr/core1,localhost:8080/solr/core2&q=some
query

That will search on both cores 1 and 2.

To facet on the datasource in order to be able to categorize the result set,
you can simply add this snippet to the query:

&facet=on&facet.field=dataSource

This will return the datasources that are defined with their number of
results for the query.

Making the facet results clickable in order to narrow down the results can
be achieved by adding a filter to the query and filtering to a specific
dataSource. I actually ended uo creating a fairly intuitive front-end for my
system with faceting, filtering, paging etc all using jsp and SolrJ. SolrJ
is powerful enough to handle all of the backend processing.

Good luck!






joe_coder wrote:
> 
> I missed adding some size related information in the query above.
> 
> D1 and D2 would have close to 1 million records each
> D3 would have ~10 million records.
> 
> Thanks!
> 

-- 
View this message in context: 
http://www.nabble.com/Solr-MultiCore-query-tp24534383p24534793.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to