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 Achim Domma <do...@procoders.net> on 2013/10/23 15:09:11 UTC

Having two document sets in one index, "separated" by filter query.

Hi,

I have two document sets, both having the same schema. On set is the larger reference set (lets say a few hundred thousand documents) and the smaller set is some user generated content (a few hundreds or thousands). In most cases, I just want to search on the larger reference sets but some functionality also works on both sets.

Is the following assumption correct?

I could add a field to the schema which defines what type a document is (large set or small set). Now I configure two search handlers. For one handler I add a filter query, which filters on the just defined type field. If I use this handler in my application, I should only see content from the large set and it should be impossible to get results from the small set back.

cheers,
Achim

Re: Having two document sets in one index, "separated" by filter query.

Posted by Timothy Potter <th...@gmail.com>.
Sounds correct - you probably want to use an invariant parameter in
solrconfig.xml, something along the lines of:

<lst name="invariants"> <str name="fq">docset:0</str> </lst>

Where docset is the new field you add to the schema to determine which set
a document belongs to. You might also consider adding a newSearcher warming
query that includes this fq so that the filter gets cached everytime you
open a new searcher.

On Wed, Oct 23, 2013 at 7:09 AM, Achim Domma <do...@procoders.net> wrote:

> Hi,
>
> I have two document sets, both having the same schema. On set is the
> larger reference set (lets say a few hundred thousand documents) and the
> smaller set is some user generated content (a few hundreds or thousands).
> In most cases, I just want to search on the larger reference sets but some
> functionality also works on both sets.
>
> Is the following assumption correct?
>
> I could add a field to the schema which defines what type a document is
> (large set or small set). Now I configure two search handlers. For one
> handler I add a filter query, which filters on the just defined type field.
> If I use this handler in my application, I should only see content from the
> large set and it should be impossible to get results from the small set
> back.
>
> cheers,
> Achim