AND operation on multiple documents in lucene

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

AND operation on multiple documents in lucene

I am new into lucene. Currently I am stuck in one query search implementation, we store some mail information into lucene as by number documents. One mail can have 5-6 docs . Added below a sample structure of data,

1) "id": "1","sendr_name": "sender1", "recip_name": "recipient1", "subject": "subject1"
2) "id": "1","attachment": "attachment1"
3) "id": "1","domain": "domain1", "ip": "ip1"
5) "id": "1","mid": "mid1"
6) "id": "1","type": "type1"

7) "id": "2","sendr_name": "sender1", "recip_name": "recipient1", "subject": "subject1"
8) "id": "2","attachment": "attachment2"
9) "id": "2","domain": "domain1", "ip": "ip2"
10) "id": "2","mid": "mid2"
11) "id": "2","type": "type2"

12) "id": "3","sendr_name": "sender1", "recip_name": "recipient3", "subject": "subject3"
13) "id": "3","attachment": "attachment3"
14) "id": "3","domain": "domain1", "ip": "ip3"
15) "id": "3","mid": "mid3"
16) "id": "3","type": "type3"

Note : serial no. 1-16 are documents for different mails and field "id" get generated internally , so id value cannot use as query value by user.

My need is to extract one mail or some mail info as by querying like

+sendr_name:sender1 + recip_name:recipient1 +subject:subject1 +attachment:attachment1 +domain:domain1 +mid:mid1

This is to get mail 1 info(1-6 docs for mail 1) . But above query fails to return result because attachment, mid and domain in different docs. Is there any way that we can span AND condition to multiple docs? or is there anyway that we can join query on a field like = I request you all to provide your suggestions or help to solve this issue.