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 Rahul Warawdekar <ra...@gmail.com> on 2011/09/12 17:44:01 UTC

Solr: Return field names that contain search term

Hi,

I have a a query on Solr search as follows.

I am indexing an entity which includes a multivalued field using DIH.
This multivalued field contains content from multiple attachments for
a single entity.

Now, for eg. if i search for the term "solr", will I be able to know
which field contains this search term ?
And if it is a multivaued field, which field number in that
multivalued field contains the search term ?

Currently, to achieve this, I am using a workaround using the
highlighting feature.
I am indexing all the multiple attachments within a single entity and
document as dynamic fields "<attachment_id>_i".

While searching, I am highlighting on these dynamic fields (hl.fl=*_i)
and from the highlighitng section in the results, I am able to get the
attachment number which contains the search term.
But since this approach involves highlighting large attachments, the
search response times are very slow.

Would highly appreciate if someone can suggest other efficient ways to
address this kind of a requirement.

-- 
Thanks and Regards
Rahul A. Warawdekar

Re: Solr: Return field names that contain search term

Posted by sunayana1991 <su...@gmail.com>.
Hi rahul,

I am working on a similar scenario, was wondering if you find a way to
resolve this.

Thanks in advance!



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Return-field-names-that-contain-search-term-tp3329993p4321399.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr: Return field names that contain search term

Posted by Rahul Warawdekar <ra...@gmail.com>.
Thanks Chris !

Will try out the second approach you suggested and share my findings.

On Mon, Sep 12, 2011 at 5:03 PM, Chris Hostetter
<ho...@fucit.org>wrote:

>
> : > Would highly appreciate if someone can suggest other efficient ways to
> : > address this kind of a requirement.
>
> one approach would be to index each attachment as it's own document and
> search those.  you could then use things like the group collapsing
> features to return onlly the "main" type documents when multiple
> attachments match.
>
> similarly: you could still index each "main" document with a giant
> text field containing all of the attachment text, *and* you could indx
> each attachment as it's own document.  You would search on the main docs
> as you do now, but then your app could issue a secondary request searching
> for all  "attachment" docs that match on one of the main docIds in a
> special field, and use the results to note which attachment of each doc
> (if any) caused the match.
>
> -Hoss
>



-- 
Thanks and Regards
Rahul A. Warawdekar

Re: Solr: Return field names that contain search term

Posted by Chris Hostetter <ho...@fucit.org>.
: > Would highly appreciate if someone can suggest other efficient ways to
: > address this kind of a requirement.

one approach would be to index each attachment as it's own document and 
search those.  you could then use things like the group collapsing 
features to return onlly the "main" type documents when multiple 
attachments match.

similarly: you could still index each "main" document with a giant 
text field containing all of the attachment text, *and* you could indx 
each attachment as it's own document.  You would search on the main docs 
as you do now, but then your app could issue a secondary request searching 
for all  "attachment" docs that match on one of the main docIds in a 
special field, and use the results to note which attachment of each doc 
(if any) caused the match.

-Hoss

Re: Solr: Return field names that contain search term

Posted by da...@ontrenet.com.
I also would like to know the answer to this. But my feeling is
that you can't do what you want. I also had to use the highlighting
workaround and aggregate dynamic field to accomplish the inability
of multivalued fields to accommodate it.

On Mon, 12 Sep 2011 11:44:01 -0400, Rahul Warawdekar
<ra...@gmail.com> wrote:
> Hi,
> 
> I have a a query on Solr search as follows.
> 
> I am indexing an entity which includes a multivalued field using DIH.
> This multivalued field contains content from multiple attachments for
> a single entity.
> 
> Now, for eg. if i search for the term "solr", will I be able to know
> which field contains this search term ?
> And if it is a multivaued field, which field number in that
> multivalued field contains the search term ?
> 
> Currently, to achieve this, I am using a workaround using the
> highlighting feature.
> I am indexing all the multiple attachments within a single entity and
> document as dynamic fields "<attachment_id>_i".
> 
> While searching, I am highlighting on these dynamic fields (hl.fl=*_i)
> and from the highlighitng section in the results, I am able to get the
> attachment number which contains the search term.
> But since this approach involves highlighting large attachments, the
> search response times are very slow.
> 
> Would highly appreciate if someone can suggest other efficient ways to
> address this kind of a requirement.