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 Jagrut Sharma <ja...@gmail.com> on 2017/06/23 01:05:35 UTC

Collection name in result

I'm submitting a search term to SolrCloud to query 2 collections. The
response that comes back does not have the collection name from which the
result came.

Is it possible to know the collection which returned the result?

Thanks.

-- 
Jagrut

Re: Collection name in result

Posted by Jagrut Sharma <ja...@gmail.com>.
Thanks Erick & Alessandro. I am querying the collections by including
'&collection=c1,c2' syntax in the query. The suggestion of adding an
additional field to the schema works. I configured this additional field to
hold the collection's name and now the result from the collection includes
the name.

--
Jagrut

On Fri, Jun 23, 2017 at 7:51 AM, Erick Erickson <er...@gmail.com>
wrote:

> Hmmmm, you might be able to use a DocTransformer. Hmm, in fact that
> would work if you can keep the two separate. It just injects fields
> into the docs when they're being output. It would be the world's
> simplest transformer if it injected a hard-coded collection name
> (you'd have to have unique transformers per collection). With a little
> more work it should be possible to get the collection name from the
> available data.
>
> Best,
> Erick
>
> On Fri, Jun 23, 2017 at 2:21 AM, alessandro.benedetti
> <a....@sease.io> wrote:
> > I second Erick,
> > it would be as easy as adding this field to the schema :
> >
> > <field name=&quot;collection&quot; type=&quot;string&quot;
> > indexed=&quot;false&quot; stored=&quot;true&quot; default=&quot;&lt;your
> > collection name>"/>
> >
> > If you are using inter collections queries, just be aware there a lot of
> > tricky and subtle problems with it ( such as unique Identifier must have
> > same field name, distributed IDF inter collections ect ect)
> > I am preparing a blog post related that.
> > I will keep you updated.
> >
> > Cheers
> >
> >
> >
> > -----
> > ---------------
> > Alessandro Benedetti
> > Search Consultant, R&D Software Engineer, Director
> > Sease Ltd. - www.sease.io
> > --
> > View this message in context: http://lucene.472066.n3.
> nabble.com/Collection-name-in-result-tp4342474p4342501.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Collection name in result

Posted by Erick Erickson <er...@gmail.com>.
Hmmmm, you might be able to use a DocTransformer. Hmm, in fact that
would work if you can keep the two separate. It just injects fields
into the docs when they're being output. It would be the world's
simplest transformer if it injected a hard-coded collection name
(you'd have to have unique transformers per collection). With a little
more work it should be possible to get the collection name from the
available data.

Best,
Erick

On Fri, Jun 23, 2017 at 2:21 AM, alessandro.benedetti
<a....@sease.io> wrote:
> I second Erick,
> it would be as easy as adding this field to the schema :
>
> <field name=&quot;collection&quot; type=&quot;string&quot;
> indexed=&quot;false&quot; stored=&quot;true&quot; default=&quot;&lt;your
> collection name>"/>
>
> If you are using inter collections queries, just be aware there a lot of
> tricky and subtle problems with it ( such as unique Identifier must have
> same field name, distributed IDF inter collections ect ect)
> I am preparing a blog post related that.
> I will keep you updated.
>
> Cheers
>
>
>
> -----
> ---------------
> Alessandro Benedetti
> Search Consultant, R&D Software Engineer, Director
> Sease Ltd. - www.sease.io
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Collection-name-in-result-tp4342474p4342501.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Re: Collection name in result

Posted by "alessandro.benedetti" <a....@sease.io>.
I second Erick,
it would be as easy as adding this field to the schema :

<field name=&quot;collection&quot; type=&quot;string&quot;
indexed=&quot;false&quot; stored=&quot;true&quot; default=&quot;&lt;your
collection name>"/>

If you are using inter collections queries, just be aware there a lot of
tricky and subtle problems with it ( such as unique Identifier must have
same field name, distributed IDF inter collections ect ect)
I am preparing a blog post related that.
I will keep you updated.

Cheers



-----
---------------
Alessandro Benedetti
Search Consultant, R&D Software Engineer, Director
Sease Ltd. - www.sease.io
--
View this message in context: http://lucene.472066.n3.nabble.com/Collection-name-in-result-tp4342474p4342501.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Collection name in result

Posted by Erick Erickson <er...@gmail.com>.
How are you submitting the query to to collections? Aliasing to them both?

The simplest would be just to index the name of the collection with
each doc and return that field

Best,
Erick

On Thu, Jun 22, 2017 at 6:05 PM, Jagrut Sharma <ja...@gmail.com> wrote:
> I'm submitting a search term to SolrCloud to query 2 collections. The
> response that comes back does not have the collection name from which the
> result came.
>
> Is it possible to know the collection which returned the result?
>
> Thanks.
>
> --
> Jagrut