A better way could be:

*select *, $posts *
*from User *
*let $posts = (select expand(in('author')) from $parent.$current)*
*where username = ..*

The $parent.$current would be a specific user, you then expand the edge to 
the posts. Which you then return as $posts
Not entirely sure of the direction of you edge but I'm sure you figure it 
out!

I know nothing about RID_BAG_EMBEDDED_TO_SBTREEBONSAI_THRESHOLD  thou.

/ Johan

On Tuesday, September 1, 2015 at 2:13:13 PM UTC+2, Davide Neri wrote:
>
> Hi,
> I am developing a web app on node.js and using OrientDB.
> For some functionalities I need to make queries on a structure like this:
>
> User (V)
> Post (V)
>
> author (E)
>
> User -- author --› Post
>
>
> And queries should retrieve the User(s) element(s) and the posts he is 
> author of...all in the same structure:
>
> [ {
>     @rid: #9:1,
>     @class: User,
>     name: user1,
>     posts: [ {
>                    @rid: #10:1,
>                    @class: Post,
>                    name: post1
>                  }, {
>                    @rid: #10:2,
>                    @class: Post,
>                    name: post2
>                  } ]
>   }, {
>     @rid: #9:2,
>     @class: User,
>     name: user2,
>     posts: [ ... ]
>   } ]
>
>
> Basically, I'm currently doing this in 2 steps:
>
> *select * from User where ...*
>
>
> where I get something like:
>
> [ {
>     @rid: #9:1,
>     @class: User,
>     name: user1,
>     out_author: [#10:1, #10:2]
>   }, {
>     @rid: #9:2,
>     @class: User,
>     name: user2,
>     out_author: [#10:3, #10:3]
>   } ]
>
>
> From this result I collect all the rids of the first query and make a 
> second query:
>
> *select expand(out('author')) from Post where @rid in [USERS_RIDS]*
>
>
> where I get something like:
>
> [ {
>     @rid: #10:1,
>     @class: Post,
>     name: post1
>   }, {
>     @rid: #10:2,
>     @class: Post,
>     name: post2
>   } ]
>
>
>
> And in the end I merge the results of the two queries by matching the 
> @rids in out_author of the first results and @rids of the Posts in the 
> second results.
>
> This all works well, until I have just a few edges.. but when edges start 
> to become more than 40 the out_author becomes blank...and my whole 
> algorithm breaks. So here are my two questions:
>
> - I was reading that to have more rids returned I need to change the 
> RID_BAG_EMBEDDED_TO_SBTREEBONSAI_THRESHOLD to a bigger number... I tried to 
> change the orientdb-server-config.xml adding an entry in properties....but 
> I can't see any results. I'm pretty sure I'm adding a wrong entry, but I 
> can't understand any clear explanation of what I should do. Do you know 
> what exactly should I do to change this value?
>
> - Also... is there another better way to achieve the same result I need to 
> have with my algorithm? Is it possible to be achieved with a single query 
> or in some way that doesn't rely on matching rids?
>
>
>
> Thank you very much for your help!
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to orient-database+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to