I found one solution, however i am not sure whether this is
optimized/corrct solution to it.

Return a mails which contains a word 'pdf' anywhere  : *({!parent
which=internetMessageId:* v=pdf}) OR (internetMessageId:* AND pdf)*
a) ({!parent which=internetMessageId:* v=pdf}) ==> return mails whose
attachment has the keyword 'pdf'
b) (internetMessageId:* AND pdf) ==> returns only mails which contains the
word 'pdf'

Solr identify mail document with *internetMessageId:* *as this field is not
present in attachment document


Please let me know if this is right approch/way to query such results or *Is
there any better/optimized approach*

Thanks,
Rushikesh Garadade

On Tue, Jun 19, 2018 at 6:33 PM Rushikesh Garadade <
rushikeshgarad...@gmail.com> wrote:

> Hello,
> I have stored emails in solr, with its attachments as child documents.
> As per solr structure these attachments got stored in same lines as of
> mails.
> Ex:
> { "id":"1528801242887_f662e5fe-b5d7-4494-acab-c1a99e6cd025", "
> attachmentName":"example_multipage.doc", "attachmentType":
> "application/msword", "_version_":1603064318599888896}, { "id":
> "1528801242887", "internetMessageId":"1528801242887", "mailboxMessageId":
> "MailBox_4", "from":"mitur...@verizon.net", "to":["podmas...@live.com"], "
> cc":["gslon...@aol.com"], "bcc":["notic...@msn.com", "bes...@gmail.com"],
> "subject":"Getting Started", "mailBody":"\n\nGoogle's headquarters, the
> Googleplex, in August 2014\n ", "mailReceiveDate":"2018-05-07T12:33:51Z",
> "hasAttachment":true, "_version_":1603064318599888896}
>
> }
>
> Now I want to perform search. What will be search query for:
>
> I want to search a keyword everywhere and return the respective 
> "internetMessageId".
> i.e.
> #1 if word found in mail document -- return internetMessageId
> #2 if word found in attachment document document -- return internetMessageId
> (By fq==>{!parent which=internetMessageId:* v=attachmentName:*})
>
> For achieving both i have store every fields content in "_text_" field
> (using copy field) . I can achieve both #1 & #2 individually. I want to do
> both in single result i.e give me internetMessageId of all mails as well
> as the mails whose attachment contains the the queried word.
>
>
> How can I achieve this??
>
>
> Thanks,
> Rushikesh Garadade
>
>

Reply via email to