Re: [Neo4j] Graph database index | query across indices

2011-08-11 Thread Mattias Persson
The slight mismatch being one is a node index and the other a relationship
index, but it's just a matter of choosing end/start node to index really.

2011/8/10 Rick Bullotta 

> or of course you could just put it all in one index.
>
> -Original Message-
> From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org]
> On Behalf Of Mattias Persson
> Sent: Wednesday, August 10, 2011 3:31 PM
> To: Neo4j user discussions
> Subject: Re: [Neo4j] Graph database index | query across indices
>
> Compound query between two indices isn't possible, but you could just query
> both and intersect the node set with the end or start node set from the
> relationships.
>
> 2011/7/27 sambodhi sagi 
>
> > Hi !
> >
> > I am facing some problem with indexing. My graph looks like this:
> >
> >
> >
> >
> > Say, I want to query products for a particular category (say
> 'Phone,Mobiles
> > and telecoms') AND having text 'attractive' in 'details' field. I created
> > two indices: one for Relationship 'RelProductIndex' and one for product
> > 'ProductIndex'. Algo for what I exactly want to achieve :
> >
> > typeHits = relProdctIndex.query( "type:Product", phoneAndTelecomCatNode,
> > null );
> > for each typeHits {
> >  productsInCatList.add(typeHits.getEndNode());
> > }
> >
> > productsTextSearchHits = productIndex.query("details", "attractive");
> >
> > resultantProducts =  common set between productsInCatList and
> > productsTextSearchHits
> >
> > My query is something like this
> >
> > QUERY-1 AND QUERY-2
> >
> > QUERY-1 : EndNodes (say end node is a product) of a relationship of type
> > 'Product' (this query is for RelProductIndex)
> > QUERY-2 : products which has text 'mobile' (this query is for
> > ProductsIndex)
> >
> > So basically what it requires is *compound query across two indices*.
> > Normally we donot do compound queries across indices but am not sure how
> to
> > handle this.* One solution* I can think of is to add 'details' property
> to
> > the relationship Product also. In this case I can use only relationship
> > index:
> >
> > typeHits = relProdctIndex.query( "type:Product AND details:attractive",
> > phoneAndTelecomCatNode, null );
> >
> > Problem I see with this approach is, I would end up indexing same
> field(or
> > key) in two different indices (Product node and Product relationship).
> This
> > might hit the performance.* Can there be a better approach to handle
> this?*
> > ___
> > Neo4j mailing list
> > User@lists.neo4j.org
> > https://lists.neo4j.org/mailman/listinfo/user
> >
>
>
>
> --
> Mattias Persson, [matt...@neotechnology.com]
> Hacker, Neo Technology
> www.neotechnology.com
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Graph database index | query across indices

2011-08-10 Thread Rick Bullotta
or of course you could just put it all in one index.

-Original Message-
From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On 
Behalf Of Mattias Persson
Sent: Wednesday, August 10, 2011 3:31 PM
To: Neo4j user discussions
Subject: Re: [Neo4j] Graph database index | query across indices

Compound query between two indices isn't possible, but you could just query
both and intersect the node set with the end or start node set from the
relationships.

2011/7/27 sambodhi sagi 

> Hi !
>
> I am facing some problem with indexing. My graph looks like this:
>
>
>
>
> Say, I want to query products for a particular category (say 'Phone,Mobiles
> and telecoms') AND having text 'attractive' in 'details' field. I created
> two indices: one for Relationship 'RelProductIndex' and one for product
> 'ProductIndex'. Algo for what I exactly want to achieve :
>
> typeHits = relProdctIndex.query( "type:Product", phoneAndTelecomCatNode,
> null );
> for each typeHits {
>  productsInCatList.add(typeHits.getEndNode());
> }
>
> productsTextSearchHits = productIndex.query("details", "attractive");
>
> resultantProducts =  common set between productsInCatList and
> productsTextSearchHits
>
> My query is something like this
>
> QUERY-1 AND QUERY-2
>
> QUERY-1 : EndNodes (say end node is a product) of a relationship of type
> 'Product' (this query is for RelProductIndex)
> QUERY-2 : products which has text 'mobile' (this query is for
> ProductsIndex)
>
> So basically what it requires is *compound query across two indices*.
> Normally we donot do compound queries across indices but am not sure how to
> handle this.* One solution* I can think of is to add 'details' property to
> the relationship Product also. In this case I can use only relationship
> index:
>
> typeHits = relProdctIndex.query( "type:Product AND details:attractive",
> phoneAndTelecomCatNode, null );
>
> Problem I see with this approach is, I would end up indexing same field(or
> key) in two different indices (Product node and Product relationship). This
> might hit the performance.* Can there be a better approach to handle this?*
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Graph database index | query across indices

2011-08-10 Thread Mattias Persson
Compound query between two indices isn't possible, but you could just query
both and intersect the node set with the end or start node set from the
relationships.

2011/7/27 sambodhi sagi 

> Hi !
>
> I am facing some problem with indexing. My graph looks like this:
>
>
>
>
> Say, I want to query products for a particular category (say 'Phone,Mobiles
> and telecoms') AND having text 'attractive' in 'details' field. I created
> two indices: one for Relationship 'RelProductIndex' and one for product
> 'ProductIndex'. Algo for what I exactly want to achieve :
>
> typeHits = relProdctIndex.query( "type:Product", phoneAndTelecomCatNode,
> null );
> for each typeHits {
>  productsInCatList.add(typeHits.getEndNode());
> }
>
> productsTextSearchHits = productIndex.query("details", "attractive");
>
> resultantProducts =  common set between productsInCatList and
> productsTextSearchHits
>
> My query is something like this
>
> QUERY-1 AND QUERY-2
>
> QUERY-1 : EndNodes (say end node is a product) of a relationship of type
> 'Product' (this query is for RelProductIndex)
> QUERY-2 : products which has text 'mobile' (this query is for
> ProductsIndex)
>
> So basically what it requires is *compound query across two indices*.
> Normally we donot do compound queries across indices but am not sure how to
> handle this.* One solution* I can think of is to add 'details' property to
> the relationship Product also. In this case I can use only relationship
> index:
>
> typeHits = relProdctIndex.query( "type:Product AND details:attractive",
> phoneAndTelecomCatNode, null );
>
> Problem I see with this approach is, I would end up indexing same field(or
> key) in two different indices (Product node and Product relationship). This
> might hit the performance.* Can there be a better approach to handle this?*
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Graph database index | query across indices

2011-07-27 Thread sambodhi
please click 
https://docs.google.com/leaf?id=0B_KtEQOQZhiJOTU4NDNkYjUtMTRhZS00MDgwLWI3NjEtYmZjNTM5NGNhNjVj&hl=en_US
here  to see my 
https://docs.google.com/leaf?id=0B_KtEQOQZhiJOTU4NDNkYjUtMTRhZS00MDgwLWI3NjEtYmZjNTM5NGNhNjVj&hl=en_US
graph 


--
View this message in context: 
http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-Graph-database-index-query-across-indices-tp3203597p3203647.html
Sent from the Neo4j Community Discussions mailing list archive at Nabble.com.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] Graph database index | query across indices

2011-07-27 Thread sambodhi sagi
Hi !

I am facing some problem with indexing. My graph looks like this:




Say, I want to query products for a particular category (say 'Phone,Mobiles
and telecoms') AND having text 'attractive' in 'details' field. I created
two indices: one for Relationship 'RelProductIndex' and one for product
'ProductIndex'. Algo for what I exactly want to achieve :

typeHits = relProdctIndex.query( "type:Product", phoneAndTelecomCatNode,
null );
for each typeHits {
  productsInCatList.add(typeHits.getEndNode());
}

productsTextSearchHits = productIndex.query("details", "attractive");

resultantProducts =  common set between productsInCatList and
productsTextSearchHits

My query is something like this

QUERY-1 AND QUERY-2

QUERY-1 : EndNodes (say end node is a product) of a relationship of type
'Product' (this query is for RelProductIndex)
QUERY-2 : products which has text 'mobile' (this query is for ProductsIndex)

So basically what it requires is *compound query across two indices*.
Normally we donot do compound queries across indices but am not sure how to
handle this.* One solution* I can think of is to add 'details' property to
the relationship Product also. In this case I can use only relationship
index:

typeHits = relProdctIndex.query( "type:Product AND details:attractive",
phoneAndTelecomCatNode, null );

Problem I see with this approach is, I would end up indexing same field(or
key) in two different indices (Product node and Product relationship). This
might hit the performance.* Can there be a better approach to handle this?*
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user