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 Rushikesh Garadade <ru...@gmail.com> on 2018/08/20 15:08:42 UTC
getParent() when searched in child Docuement
Hi All,
I have mail as Docuement and mail's attachments as childDocument in solr.
I am trying to write spring data application to search in all fields and
return mail document.
There is one solution :
{!parent which="<MAIL DOCUMENT IDENTIFIER >" v=<MAIL ATTACHEMENT SEARCH>}
but for this to work-> "<MAIL ATTACHEMENT SEARCH>" keyword should only be
present in attachement document(child) and not in Mail docuement(parent).
is there any way via which
1) We search for any keyword and if it is present in mail attachment
document its respective mail (its parent) should be returned.
( I have used copy field '_text_" which copy all fields data in it.)
2) If we Search for any specific field in attahcment its parent should
return . For example "get mail document whose attachmentName:"abc.txt"".
I want to know how to implement this in Spring Data. (there is some method
called getParent() however I am not sure how to use it).
Thanks ,
Rushikesh Garadade
Re: getParent() when searched in child Docuement
Posted by Mikhail Khludnev <mk...@apache.org>.
On Mon, Aug 20, 2018 at 6:08 PM Rushikesh Garadade <
rushikeshgaradade@gmail.com> wrote:
> Hi All,
> I have mail as Docuement and mail's attachments as childDocument in solr.
> I am trying to write spring data application to search in all fields and
> return mail document.
> There is one solution :
> {!parent which="<MAIL DOCUMENT IDENTIFIER >" v=<MAIL ATTACHEMENT SEARCH>}
>
which="<MAIL DOCUMENT IDENTIFIER >" seems wrong. Please check the warning
in parent query parser documentation.
>
> but for this to work-> "<MAIL ATTACHEMENT SEARCH>" keyword should only be
> present in attachement document(child) and not in Mail docuement(parent).
>
> is there any way via which
> 1) We search for any keyword and if it is present in mail attachment
> document its respective mail (its parent) should be returned.
>
You need to combine with OR two clauses, one should search parent docs
field, and the later should search for child hits joining them to
{!parent}.
It's really cumbersome with usual Solr syntax.
> ( I have used copy field '_text_" which copy all fields data in it.)
>
Note: copy field doesn't transfer values between scopes (parent, child).
> 2) If we Search for any specific field in attahcment its parent should
> return . For example "get mail document whose attachmentName:"abc.txt"".
>
this is what {!parent } actually does.
>
> I want to know how to implement this in Spring Data. (there is some method
> called getParent() however I am not sure how to use it).
>
I don't know anything about it but it's hardly can help to solve any of
these problems.
>
> Thanks ,
> Rushikesh Garadade
>
--
Sincerely yours
Mikhail Khludnev