Hi Honnur! 2010/9/6, Honnur Vorvoi <vhon...@yahoo.com>: > Hello, > > I have the following questions with regard to the IndexProvider(example > below): > > 1. I already have LuceneFulltextQueryIndexService. Can I use IndexProvider > with the same graphDb as well? or are they mutually exclusive?
They are separate from one another so both can be used alongside of each other. Something stored in one of either LuceneIndexService/LuceneIndexProvider won't affect the other. > 2. What doesn the param "users" in provider.nodeIndex("users") represent? The LuceneIndexService can only keep values from one key in each index, but the new LuceneIndexProvider can spawn indexes which can contain any number of keys and values (making compound queries possible). Since an index isn't tied to a property key you must name each index yourself. Each index can also be configured to be either fulltext or not, to use lower case conversion or not, a.s.o. > 3. Do I need to add all the properties in Index<Node>(line# 4&5) in order to > query? (I have already index the same properties with > LuceneFulltextQueryIndexService) > see my answer for (1), in short: LuceneIndexProvider and the indexes it spawns has nothing to do with LuceneIndexService (or any derivative thereof) and hence can't share state. > 4. Is it easy to include the query(String) method in > LuceneFulltextQueryIndexService, so I can use just one indexservice > otherwise I would be using LuceneIndexProvider just for query(String) > method. To add compound querying the storage format (i.e. Lucene usage) needed to change in incompatible ways, so it isn't an easy fix to add that. It could however be done by querying multiple indexes in parallell and merge the results afterwards, but I don't think performance would be anywhere near using Lucene the "right way" for compound queries, as LuceneIndexProvider does. > > As alwasy, appreciate your suggestions/recommendations > > > 1 IndexProvider provider = new LuceneIndexProvider( graphDb ); > 2 Index<Node> myIndex = provider.nodeIndex( "users" ); > 3 > 4 myIndex.add( myNode, "type", "value1" ); > 5 myIndex.add( myNode, "key1", "value2" ); > 6 > 7 // Ask lucene queries directly here > 8 for ( Node searchHit : myIndex.query( "type:value1 AND key1:value2" ) > ) > 9 { > 10 System.out.println( "Found " + searchHit ); > 11 } > _______________________________________________ > 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