Is there any way to emulate a "has_parent" type of functionality?


(Jim) #1

Hello,

First off, thank you so much for creating this amazing indexing
platform. I am enjoying it so far and would like to use it on a
project I am on.

Secondly, I searched this group and couldn't find anyone else asking
about this, so I am sorry in advanced if this has been asked before.

The situation I have right now is I have two types: episode and
story. Episodes are parents to stories.

I want to run a query on stories, filtered or queried based on content
on the Episode.

For instance:

Episode -
Date: 01/01/2011
Newscaster: Bob Jones

Story (child of episode) -
Segment number: 1

I want to write a query that will return all stories who have a parent
episode that has the Newscaster "Bob Jones". Is there any way to do
this? My alternate option if I cannot is to store some Episode
content in the Story index so I can get the results I want, but
ideally I would like to keep them in their own types and query them
via that parent/child relationship.

I know "has_child" finds a parent's children that match a specific
query, but I wanted to see if there was a way to build this
"has_parent" type of functionality that would find all children whose
parents match a specific query.

Any idea if this is currently possible?

Thanks,
Jim


(Karussell) #2

If you index the parent_id or even parents' 'Newscaster' (requires
some more storage+RAM) in the childs too, then its a simple filter
query ala "type:story AND parent_newcaster:'Bob Jones'"

Peter.

On Nov 8, 2:45 am, Jim schm...@gmail.com wrote:

Hello,

First off, thank you so much for creating this amazing indexing
platform. I am enjoying it so far and would like to use it on a
project I am on.

Secondly, I searched this group and couldn't find anyone else asking
about this, so I am sorry in advanced if this has been asked before.

The situation I have right now is I have two types: episode and
story. Episodes are parents to stories.

I want to run a query on stories, filtered or queried based on content
on the Episode.

For instance:

Episode -
Date: 01/01/2011
Newscaster: Bob Jones

Story (child of episode) -
Segment number: 1

I want to write a query that will return all stories who have a parent
episode that has the Newscaster "Bob Jones". Is there any way to do
this? My alternate option if I cannot is to store some Episode
content in the Story index so I can get the results I want, but
ideally I would like to keep them in their own types and query them
via that parent/child relationship.

I know "has_child" finds a parent's children that match a specific
query, but I wanted to see if there was a way to build this
"has_parent" type of functionality that would find all children whose
parents match a specific query.

Any idea if this is currently possible?

Thanks,
Jim


(Jim) #3

Thank you for your response!

That is what I plan on doing in case there is no other way to query
children based on criteria for the parent without duplicating the
content in the index.

I am just trying to avoid putting parent information on the child, but
if it is not possible at the moment that is okay.

Thanks,
Jim

On Nov 8, 2:26 am, Karussell tableyourt...@googlemail.com wrote:

If you index the parent_id or even parents' 'Newscaster' (requires
some more storage+RAM) in the childs too, then its a simple filter
query ala "type:story AND parent_newcaster:'Bob Jones'"

Peter.

On Nov 8, 2:45 am, Jim schm...@gmail.com wrote:

Hello,

First off, thank you so much for creating this amazing indexing
platform. I am enjoying it so far and would like to use it on a
project I am on.

Secondly, I searched this group and couldn't find anyone else asking
about this, so I am sorry in advanced if this has been asked before.

The situation I have right now is I have two types: episode and
story. Episodes are parents to stories.

I want to run a query on stories, filtered or queried based on content
on the Episode.

For instance:

Episode -
Date: 01/01/2011
Newscaster: Bob Jones

Story (child of episode) -
Segment number: 1

I want to write a query that will return all stories who have a parent
episode that has the Newscaster "Bob Jones". Is there any way to do
this? My alternate option if I cannot is to store some Episode
content in the Story index so I can get the results I want, but
ideally I would like to keep them in their own types and query them
via that parent/child relationship.

I know "has_child" finds a parent's children that match a specific
query, but I wanted to see if there was a way to build this
"has_parent" type of functionality that would find all children whose
parents match a specific query.

Any idea if this is currently possible?

Thanks,
Jim


(system) #4