Steve,

Using shards is actually quite simple; it's just a matter of setting up your
shards (via multiple cores, or multiple instances of SOLR) and then passing
the shards parameter in the query string. The shards parameter is a
comma-separated list of the servers/cores you wish to use together.

So, let's try this using a fictitious example. You have two cores, one
called main for your main data set of metadata and favorites for your user
favorites meta data. You set up each schema accordingly, and you've indexed
your data. When you want to do a query on both sets of data you would build
your query appropriately, and then use the following URL (the host is
assumed to be localhost for simplicity):

http://localhost/solr/main/select?q=id:[*+TO+*]&shards=localhost/solr/main,localhost/solr/favorites&rows=100&start=0

I am personally investigating using this technique to tie together two cores
that utilize different schemas; one schema will contain news articles,
blogs, and similar types of data, while another schema will contain
company-specific information, such as addresses, etc. If you're still having
trouble after trying this, let me know and I'd be more than happy to share
any findings that I come across.

I hope that this helps to clear things up for you. :)

- Ken

It looked like something resembling white marble, which was
probably what it was: something resembling white marble.
                -- Douglas Adams, "The Hitchhikers Guide to the Galaxy"


On Thu, Oct 14, 2010 at 4:25 AM, Lohrenz, Steven
<steven.lohr...@hmhpub.com>wrote:

> Ken,
>
> I have been through that page many times. I could use Distributed search
> for what? The first scenario or the second?
>
> The question is: can I merge a set of results from the two cores/shards and
> only return results that exist in both (determined by the resourceId, which
> exists on both)?
>
> Cheers,
> Steve
>
> -----Original Message-----
> From: Ken Stanley [mailto:doh...@gmail.com]
> Sent: 13 October 2010 20:08
> To: solr-user@lucene.apache.org
> Subject: Re: Searching Across Multiple Cores
>
> On Wed, Oct 13, 2010 at 2:11 PM, Lohrenz, Steven
> <steven.lohr...@hmhpub.com>wrote:
>
> > Hi,
> >
> > I am trying to figure out if how I can accomplish the following:
> >
> > I have a fairly static and large set of resources I need to have indexed
> > and searchable. Solr seems to be a perfect fit for that. In addition I
> need
> > to have the ability for my users to add resources from the main data set
> to
> > a 'Favourites' folder (which can include a few more tags added by them).
> The
> > Favourites needs to be searchable in the same manner as the main data
> set,
> > across all the same fields.
> >
> > My first thought was to have two separate schemas
> > - the first  for the main data set and its metadata
> > - the second for the Favourites folder with all of the metadata from the
> > main set copied over and then adding the additional fields.
> >
> > Then I thought that would probably waste quite a bit of space (the number
> > of users is much larger than the number of main resources).
> >
> > So then I thought I could have the main data set with its metadata. Then
> > there would be second one for the Favourites folder with the unique id
> from
> > the first and the additional fields it needs (userId, grade, folder,
> tag).
> > In addition, I would create another schema/core with all the fields from
> the
> > other two and have a request handler defined on it that searches across
> the
> > other 2 cores and returns the results through this core.
> >
> > This third core would have searches run against it where the results
> would
> > expect to only be returned for a single user. For example, a user
> searches
> > their Favourites folder for all the items with Foo. The result is only
> those
> > items the user has added to their Favourites with Foo somewhere in their
> > main data set metadata.
> >
> > Could this be made to work? What would the consequences be? Any
> alternative
> > suggestions?
> >
> > Thanks,
> > Steve
> >
> >
> Steve,
>
> From your description, it really sounds like you could reap the benefits of
> using Distributed Search in SOLR:
>
> http://wiki.apache.org/solr/DistributedSearch
>
> I hope that this helps.
>
> - Ken
>

Reply via email to