[Neo4j] Index search with more than one key

Mattias Persson mattias at neotechnology.com
Wed Aug 25 10:28:10 CEST 2010


There's a prototype implementation of a new index which solves this (and
some other issues as well, f.ex. indexing for relationships). The code is at
https://svn.neo4j.org/laboratory/components/lucene-index/ and it's built and
deployed over at http://m2.neo4j.org/org/neo4j/neo4j-lucene-index/

The new index isn't compatible with the old one so you'll have to index your
data with the new index framework to be able to use it.

    IndexProvider provider = new LuceneIndexProvider( graphDb );
    Index<Node> myIndex = provider.nodeIndex( "users" );

    myIndex.add( myNode, "type", "value1" );
    myIndex.add( myNode, "key1", "value2" );

    // Ask lucene queries directly here
    for ( Node searchHit : myIndex.query( "type:value1 AND key1:value2" ) )
    {
        System.out.println( "Found " + searchHit );
    }

2010/8/25 Honnur Vorvoi <vhonnur at yahoo.com>

> Hello,
>
> Is there a way we can search nodes based on more than one property key?
> For ex:
> Node1:
> type=value1,
> key1=value2
>
> node2:
> type=value1,
> key1=value21
>
> node3:
> type=value2
> key1=value2
>
> node4:
> type=value1
> key1=value21
> key2=value4
>
> Let's say type & key1 properties are indexed
> Any suggestions on how we can get all nodes with type=value1 AND
> key1=value21 in one call.
>
>
> TIA
> _______________________________________________
> Neo4j mailing list
> User at lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Mattias Persson, [mattias at neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com


More information about the User mailing list