lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aurélien MAZOYER <>
Subject Re: Query nested document
Date Mon, 20 Oct 2014 19:43:19 GMT
Hi again,

Maybe the only way to do this is to use nested documents and to index 
data both in child documents and in flattened form in the parent 
document. Then we can run the two different queries.

Any other (better) idea?



Le 20/10/2014 13:40, a écrit :
> Hi,
> I have question regarding nested document queries:
> For example, let’s say that I have the following book:
> Book _title: Nested document for dummies
> Chapter1_Title: Introduction
> Chapter1_Content: Nested documents are fun.
> Chapter2_Title: Which technology should I use?
> Chapter2_Content: Lucene of course!
> First I want to find books that contain an introduction and that are 
> about Lucene. So I decide to flatten my data and use 3 multivalued 
> fields (Book_Title,Chapter_Title and Chapter_Content), I index my 
> document and then I get what I want when I use the following query : “ 
> chapter_title:Introduction AND chapter_title:Lucene “
> Now I want to find books that contain “fun” in a chapter called 
> “introduction”.  My model is no more valid (Chapter2_content is no 
> more linked with Chapter2_title). That is why I change my datamodel 
> and use nested documents:
> I have now a parent with a single valued field Book_title and 
> different childs with single valued fields Chapter_title and 
> Chapter_Content. Now, when I run the query “chapter_title: 
> Introduction AND chapter_content:fun” I also get what I want… But what 
> do I have to do if I want to use these two kinds of query with a 
> unique data model?
> Thank you,
> Regards,
> Aurélien MAZOYER
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message