Hi all,
I have a deeply multi-level data structure (up to 6-7 levels deep) where due to
the nature of the data some nested documents can have same type names at
various levels. How to form a proper query on a nested field that would contain
"a path" that defines that field?
I'll clarify with an example:
Reduced dataset:
[
{
id : book1,
type_s:book,
title_t : "The Way of Kings",
author_s : "Brandon Sanderson",
_childDocuments_ : [
{
id: book1_c1,
type_s:body,
text_t:"body text of the book... ",
_childDocuments_:[
{id: book2_c1_e1,
type_s:"keywords",
text_t:["The Matrix", "Neo", "character", "somebody", ...]}
]
},
{ id: book1_c2,
type_s:title,
text_t:"This book was too long.",
_childDocuments_:[
{id: book2_c1_e1,
type_s:"keywords",
text_t:["The Matrix", "Neo"]}
]
}
]
},
...
]
So there are different paths to text_t field:
* book.body.keywords.text_t
* book.title.keywords.text_t
I need to write a query that returns, say, all books which have keyword "Neo"
in their title (not body).
I tried :
(1) q={!parent which=type_s:book}type_s:keywords AND text_t:Neo
which is obviously incorrect (returns both books whose body keywords and title
keywords contain Neo):
(2) q={!parent which=type_s:book}type_s:body^=0{!parent
which=type_s:body}type_s:keywords AND text_t:Neo
which does not return correct results (and I am not quite sure what it really
does, I just saw it in another thread of this mailing list)
Can you help me to understand whether it is possible?
Or do I have to give unique types for documents at different levels of nesting
(e.g., type_s:body_keywords & type_s:title_keywords)? I am trying to avoid,
finding a way to specify a path would be much much more preferable.
Thank you in advance and looking forward to hearing from you
--
Alisa Zhila