Re: [Neo4j] IndexProvider question
That's exactly what I was looking for. It's just awesome :) Thanks a lot Mattias. Am gonna try this out rightaway. Date: Tue, 21 Sep 2010 01:10:01 +0200 From: Mattias Persson matt...@neotechnology.com Subject: Re: [Neo4j] IndexProvider question To: Neo4j user discussions user@lists.neo4j.org Message-ID: aanlktimd6bm0ubxwptvpxm+9w5=rzdxit9cgjkmzn...@mail.gmail.com Content-Type: text/plain; charset=UTF-8 2010/9/17 Honnur Vorvoi vhon...@yahoo.com Thanks Mattias for the suggestion. What if we had a method in IndexHitsNode as below. ListIteratorNode listIterator = IndexHitsNode.getListIterator() The ListIterator can traverse in both ways as opposed to Iterator which is forward only. If that solves the reverse traverse problem for pagination, is there an easy way to get a handle to the ListIterator. Even better would be to get a handle to the underlying list (ArrayList, in this case) so we can go back and forth by List's index value. I am interested to know if the underlying implementation can facilitate this. I just created these iterators https://svn.neo4j.org/components/kernel/trunk/src/main/java/org/neo4j/helpers/collection/CachingIterator.javaand https://svn.neo4j.org/components/kernel/trunk/src/main/java/org/neo4j/helpers/collection/PagingIterator.javawhich are general purpose and does exactly what you asked for, I hope :) I haven't added something on the IndexHits interface, but you could try out using CachingIterator, or even PagingIterator (which is just a CachingIterator with convenience for handling paging). They can go back and forth through the results: IndexHitsNode hits = myNodeIndex.query( some:query ); PagingIteratorNode pages = new PagingIterator( hits, 25 ); ... IteratorNode page = pages.nextPage(); while ( page.hasNext() ) { Node node = page.next(); ... } // Go to page 10 and iterator through the items in that page pages.page( 10 ); page =pages.nextPage(); while ( page.hasNext() ) ... There aren't methods like go to the last page or so and it may have to be added for it to be useful. Try the out and write back what you think about them. Date: Thu, 16 Sep 2010 22:39:10 +0200 From: Mattias Persson matt...@neotechnology.com Subject: Re: [Neo4j] IndexProvider question To: Neo4j user discussions user@lists.neo4j.org Message-ID: aanlktinmd6-mrjrjspp92kan+de_bjbw2dp+l3+nt...@mail.gmail.comaanlktinmd6-mrjrjspp92kan%2bde_bjbw2dp%2bl3%2bnt...@mail.gmail.com Content-Type: text/plain; charset=UTF-8 I'd say wrapping the Iterator from IndexHits in something that you can do pagination on would be a good way to go. There could also be such a built-in iterator in the index component for convenience. So the CachingIterator (or whatever it'd be called) would use the underlying IndexHits iterator to lazily fetch new results it hasn't already gotten and remember them so that consecutive requests for a particular item could be returned instantly, and even be able to be positioned at an arbitrary position and iterate from there. It's a pretty generic iterator implementation and it'd be fun to implement... if I get the time for it. 2010/9/16 Honnur Vorvoi vhon...@yahoo.com Thanks a lot Mattias. I was wondering if there's a way in IndexHitsNode to actually traverse back to search results. I know we can traverse forward the search results. I am trying to implement pagination and I am caching the IndexHitsNode for the same. Say, I have already moved to the node #30, but want to return to node#20 to 25. Obviously I dont want to cache all the search results and I like the lazy loading feature in IndexHitsNode Date: Wed, 15 Sep 2010 14:16:09 +0200 From: Mattias Persson matt...@neotechnology.com Subject: Re: [Neo4j] IndexProvider question To: Neo4j user discussions user@lists.neo4j.org Message-ID: aanlkti=xmdkstyk8l49m1uiqaxroxgrq2rcv004aj...@mail.gmail.com Content-Type: text/plain; charset=UTF-8 I just added a way to do this (not as a persistent config, since they control write behaviour), but instead as an addition to QueryContext. So you can do like this: myNodeIndex.query( new QueryContext( name:Mattias occupation:developer ).defaultOperator( Operator.AND ) ); I know it's a bit verbose, but it's a start at least. Grab the latest version and try it out to see if it works for you. 2010/9/10 Mattias Persson matt...@neotechnology.com 2010/9/10, Honnur Vorvoi vhon...@yahoo.com: I would like to set AND as the default operator when I create index using the new index library: Index = indexProvider.nodeIndex( fulltext, LuceneIndexProvider.FULLTEXT_CONFIG ); I didn't find setDefaultOperator (similar to the one in LuceneFulltextQueryIndexService )in any of the provider classes. Is it supported in the new index provider? if not, is there a way we can set the same? Thanks
Re: [Neo4j] IndexProvider question
2010/9/17 Honnur Vorvoi vhon...@yahoo.com Thanks Mattias for the suggestion. What if we had a method in IndexHitsNode as below. ListIteratorNode listIterator = IndexHitsNode.getListIterator() The ListIterator can traverse in both ways as opposed to Iterator which is forward only. If that solves the reverse traverse problem for pagination, is there an easy way to get a handle to the ListIterator. Even better would be to get a handle to the underlying list (ArrayList, in this case) so we can go back and forth by List's index value. I am interested to know if the underlying implementation can facilitate this. I just created these iterators https://svn.neo4j.org/components/kernel/trunk/src/main/java/org/neo4j/helpers/collection/CachingIterator.javaand https://svn.neo4j.org/components/kernel/trunk/src/main/java/org/neo4j/helpers/collection/PagingIterator.javawhich are general purpose and does exactly what you asked for, I hope :) I haven't added something on the IndexHits interface, but you could try out using CachingIterator, or even PagingIterator (which is just a CachingIterator with convenience for handling paging). They can go back and forth through the results: IndexHitsNode hits = myNodeIndex.query( some:query ); PagingIteratorNode pages = new PagingIterator( hits, 25 ); ... IteratorNode page = pages.nextPage(); while ( page.hasNext() ) { Node node = page.next(); ... } // Go to page 10 and iterator through the items in that page pages.page( 10 ); page =pages.nextPage(); while ( page.hasNext() ) ... There aren't methods like go to the last page or so and it may have to be added for it to be useful. Try the out and write back what you think about them. Date: Thu, 16 Sep 2010 22:39:10 +0200 From: Mattias Persson matt...@neotechnology.com Subject: Re: [Neo4j] IndexProvider question To: Neo4j user discussions user@lists.neo4j.org Message-ID: aanlktinmd6-mrjrjspp92kan+de_bjbw2dp+l3+nt...@mail.gmail.comaanlktinmd6-mrjrjspp92kan%2bde_bjbw2dp%2bl3%2bnt...@mail.gmail.com Content-Type: text/plain; charset=UTF-8 I'd say wrapping the Iterator from IndexHits in something that you can do pagination on would be a good way to go. There could also be such a built-in iterator in the index component for convenience. So the CachingIterator (or whatever it'd be called) would use the underlying IndexHits iterator to lazily fetch new results it hasn't already gotten and remember them so that consecutive requests for a particular item could be returned instantly, and even be able to be positioned at an arbitrary position and iterate from there. It's a pretty generic iterator implementation and it'd be fun to implement... if I get the time for it. 2010/9/16 Honnur Vorvoi vhon...@yahoo.com Thanks a lot Mattias. I was wondering if there's a way in IndexHitsNode to actually traverse back to search results. I know we can traverse forward the search results. I am trying to implement pagination and I am caching the IndexHitsNode for the same. Say, I have already moved to the node #30, but want to return to node#20 to 25. Obviously I dont want to cache all the search results and I like the lazy loading feature in IndexHitsNode Date: Wed, 15 Sep 2010 14:16:09 +0200 From: Mattias Persson matt...@neotechnology.com Subject: Re: [Neo4j] IndexProvider question To: Neo4j user discussions user@lists.neo4j.org Message-ID: aanlkti=xmdkstyk8l49m1uiqaxroxgrq2rcv004aj...@mail.gmail.com Content-Type: text/plain; charset=UTF-8 I just added a way to do this (not as a persistent config, since they control write behaviour), but instead as an addition to QueryContext. So you can do like this: myNodeIndex.query( new QueryContext( name:Mattias occupation:developer ).defaultOperator( Operator.AND ) ); I know it's a bit verbose, but it's a start at least. Grab the latest version and try it out to see if it works for you. 2010/9/10 Mattias Persson matt...@neotechnology.com 2010/9/10, Honnur Vorvoi vhon...@yahoo.com: I would like to set AND as the default operator when I create index using the new index library: Index = indexProvider.nodeIndex( fulltext, LuceneIndexProvider.FULLTEXT_CONFIG ); I didn't find setDefaultOperator (similar to the one in LuceneFulltextQueryIndexService )in any of the provider classes. Is it supported in the new index provider? if not, is there a way we can set the same? Thanks in advance. That functionality is easy to add, I just haven't gotten around to do it. I'll try to add that as soon as possible. Excellent feedback on the new IndexProvider framework, keep it coming! --- On Thu, 9/9/10, Honnur Vorvoi vhon...@yahoo.com wrote: From: Honnur Vorvoi vhon...@yahoo.com Subject: Re: [Neo4j] IndexProvider question To: user@lists.neo4j.org
Re: [Neo4j] IndexProvider question
Thanks Mattias for the suggestion. What if we had a method in IndexHitsNode as below. ListIteratorNode listIterator = IndexHitsNode.getListIterator() The ListIterator can traverse in both ways as opposed to Iterator which is forward only. If that solves the reverse traverse problem for pagination, is there an easy way to get a handle to the ListIterator. Even better would be to get a handle to the underlying list (ArrayList, in this case) so we can go back and forth by List's index value. I am interested to know if the underlying implementation can facilitate this. Date: Thu, 16 Sep 2010 22:39:10 +0200 From: Mattias Persson matt...@neotechnology.com Subject: Re: [Neo4j] IndexProvider question To: Neo4j user discussions user@lists.neo4j.org Message-ID: aanlktinmd6-mrjrjspp92kan+de_bjbw2dp+l3+nt...@mail.gmail.com Content-Type: text/plain; charset=UTF-8 I'd say wrapping the Iterator from IndexHits in something that you can do pagination on would be a good way to go. There could also be such a built-in iterator in the index component for convenience. So the CachingIterator (or whatever it'd be called) would use the underlying IndexHits iterator to lazily fetch new results it hasn't already gotten and remember them so that consecutive requests for a particular item could be returned instantly, and even be able to be positioned at an arbitrary position and iterate from there. It's a pretty generic iterator implementation and it'd be fun to implement... if I get the time for it. 2010/9/16 Honnur Vorvoi vhon...@yahoo.com Thanks a lot Mattias. I was wondering if there's a way in IndexHitsNode to actually traverse back to search results. I know we can traverse forward the search results. I am trying to implement pagination and I am caching the IndexHitsNode for the same. Say, I have already moved to the node #30, but want to return to node#20 to 25. Obviously I dont want to cache all the search results and I like the lazy loading feature in IndexHitsNode Date: Wed, 15 Sep 2010 14:16:09 +0200 From: Mattias Persson matt...@neotechnology.com Subject: Re: [Neo4j] IndexProvider question To: Neo4j user discussions user@lists.neo4j.org Message-ID: aanlkti=xmdkstyk8l49m1uiqaxroxgrq2rcv004aj...@mail.gmail.com Content-Type: text/plain; charset=UTF-8 I just added a way to do this (not as a persistent config, since they control write behaviour), but instead as an addition to QueryContext. So you can do like this: myNodeIndex.query( new QueryContext( name:Mattias occupation:developer ).defaultOperator( Operator.AND ) ); I know it's a bit verbose, but it's a start at least. Grab the latest version and try it out to see if it works for you. 2010/9/10 Mattias Persson matt...@neotechnology.com 2010/9/10, Honnur Vorvoi vhon...@yahoo.com: I would like to set AND as the default operator when I create index using the new index library: Index = indexProvider.nodeIndex( fulltext, LuceneIndexProvider.FULLTEXT_CONFIG ); I didn't find setDefaultOperator (similar to the one in LuceneFulltextQueryIndexService )in any of the provider classes. Is it supported in the new index provider? if not, is there a way we can set the same? Thanks in advance. That functionality is easy to add, I just haven't gotten around to do it. I'll try to add that as soon as possible. Excellent feedback on the new IndexProvider framework, keep it coming! --- On Thu, 9/9/10, Honnur Vorvoi vhon...@yahoo.com wrote: From: Honnur Vorvoi vhon...@yahoo.com Subject: Re: [Neo4j] IndexProvider question To: user@lists.neo4j.org Date: Thursday, September 9, 2010, 10:33 PM Thanks Mattias. Since IndexProvider does all LuceneFulltextQueryIndexService can do and much more, I am going to use just IndexProvider. Date: Wed, 8 Sep 2010 16:28:56 +0200 From: Mattias Persson matt...@neotechnology.com Subject: Re: [Neo4j] IndexProvider question To: Neo4j user discussions user@lists.neo4j.org Message-ID: aanlktin4cjw=smw00=1nlkt8ftmys6xtnvtrve_j9...@mail.gmail.com Content-Type: text/plain; charset=UTF-8 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
Re: [Neo4j] IndexProvider question
The implementation in IndexHits doesn't keep previous results in memory, which is a good thing IMHO. So your suggestion that there should be a getListIterator on IndexHits makes sense and is really the same solution (at least how I would choose to implement it) in that it would return a new ListIterator which would have the IndexHits iterator as its underlying iterator and keep visited items around for being able to position it however. 2010/9/17 Honnur Vorvoi vhon...@yahoo.com Thanks Mattias for the suggestion. What if we had a method in IndexHitsNode as below. ListIteratorNode listIterator = IndexHitsNode.getListIterator() The ListIterator can traverse in both ways as opposed to Iterator which is forward only. If that solves the reverse traverse problem for pagination, is there an easy way to get a handle to the ListIterator. Even better would be to get a handle to the underlying list (ArrayList, in this case) so we can go back and forth by List's index value. I am interested to know if the underlying implementation can facilitate this. Date: Thu, 16 Sep 2010 22:39:10 +0200 From: Mattias Persson matt...@neotechnology.com Subject: Re: [Neo4j] IndexProvider question To: Neo4j user discussions user@lists.neo4j.org Message-ID: aanlktinmd6-mrjrjspp92kan+de_bjbw2dp+l3+nt...@mail.gmail.comaanlktinmd6-mrjrjspp92kan%2bde_bjbw2dp%2bl3%2bnt...@mail.gmail.com Content-Type: text/plain; charset=UTF-8 I'd say wrapping the Iterator from IndexHits in something that you can do pagination on would be a good way to go. There could also be such a built-in iterator in the index component for convenience. So the CachingIterator (or whatever it'd be called) would use the underlying IndexHits iterator to lazily fetch new results it hasn't already gotten and remember them so that consecutive requests for a particular item could be returned instantly, and even be able to be positioned at an arbitrary position and iterate from there. It's a pretty generic iterator implementation and it'd be fun to implement... if I get the time for it. 2010/9/16 Honnur Vorvoi vhon...@yahoo.com Thanks a lot Mattias. I was wondering if there's a way in IndexHitsNode to actually traverse back to search results. I know we can traverse forward the search results. I am trying to implement pagination and I am caching the IndexHitsNode for the same. Say, I have already moved to the node #30, but want to return to node#20 to 25. Obviously I dont want to cache all the search results and I like the lazy loading feature in IndexHitsNode Date: Wed, 15 Sep 2010 14:16:09 +0200 From: Mattias Persson matt...@neotechnology.com Subject: Re: [Neo4j] IndexProvider question To: Neo4j user discussions user@lists.neo4j.org Message-ID: aanlkti=xmdkstyk8l49m1uiqaxroxgrq2rcv004aj...@mail.gmail.com Content-Type: text/plain; charset=UTF-8 I just added a way to do this (not as a persistent config, since they control write behaviour), but instead as an addition to QueryContext. So you can do like this: myNodeIndex.query( new QueryContext( name:Mattias occupation:developer ).defaultOperator( Operator.AND ) ); I know it's a bit verbose, but it's a start at least. Grab the latest version and try it out to see if it works for you. 2010/9/10 Mattias Persson matt...@neotechnology.com 2010/9/10, Honnur Vorvoi vhon...@yahoo.com: I would like to set AND as the default operator when I create index using the new index library: Index = indexProvider.nodeIndex( fulltext, LuceneIndexProvider.FULLTEXT_CONFIG ); I didn't find setDefaultOperator (similar to the one in LuceneFulltextQueryIndexService )in any of the provider classes. Is it supported in the new index provider? if not, is there a way we can set the same? Thanks in advance. That functionality is easy to add, I just haven't gotten around to do it. I'll try to add that as soon as possible. Excellent feedback on the new IndexProvider framework, keep it coming! --- On Thu, 9/9/10, Honnur Vorvoi vhon...@yahoo.com wrote: From: Honnur Vorvoi vhon...@yahoo.com Subject: Re: [Neo4j] IndexProvider question To: user@lists.neo4j.org Date: Thursday, September 9, 2010, 10:33 PM Thanks Mattias. Since IndexProvider does all LuceneFulltextQueryIndexService can do and much more, I am going to use just IndexProvider. Date: Wed, 8 Sep 2010 16:28:56 +0200 From: Mattias Persson matt...@neotechnology.com Subject: Re: [Neo4j] IndexProvider question To: Neo4j user discussions user@lists.neo4j.org Message-ID: aanlktin4cjw=smw00=1nlkt8ftmys6xtnvtrve_j9...@mail.gmail.com Content-Type: text/plain; charset=UTF-8 Hi Honnur! 2010/9/6, Honnur Vorvoi vhon...@yahoo.com: Hello, I have the following questions with regard
Re: [Neo4j] IndexProvider question
I just added a way to do this (not as a persistent config, since they control write behaviour), but instead as an addition to QueryContext. So you can do like this: myNodeIndex.query( new QueryContext( name:Mattias occupation:developer ).defaultOperator( Operator.AND ) ); I know it's a bit verbose, but it's a start at least. Grab the latest version and try it out to see if it works for you. 2010/9/10 Mattias Persson matt...@neotechnology.com 2010/9/10, Honnur Vorvoi vhon...@yahoo.com: I would like to set AND as the default operator when I create index using the new index library: Index = indexProvider.nodeIndex( fulltext, LuceneIndexProvider.FULLTEXT_CONFIG ); I didn't find setDefaultOperator (similar to the one in LuceneFulltextQueryIndexService )in any of the provider classes. Is it supported in the new index provider? if not, is there a way we can set the same? Thanks in advance. That functionality is easy to add, I just haven't gotten around to do it. I'll try to add that as soon as possible. Excellent feedback on the new IndexProvider framework, keep it coming! --- On Thu, 9/9/10, Honnur Vorvoi vhon...@yahoo.com wrote: From: Honnur Vorvoi vhon...@yahoo.com Subject: Re: [Neo4j] IndexProvider question To: user@lists.neo4j.org Date: Thursday, September 9, 2010, 10:33 PM Thanks Mattias. Since IndexProvider does all LuceneFulltextQueryIndexService can do and much more, I am going to use just IndexProvider. Date: Wed, 8 Sep 2010 16:28:56 +0200 From: Mattias Persson matt...@neotechnology.com Subject: Re: [Neo4j] IndexProvider question To: Neo4j user discussions user@lists.neo4j.org Message-ID: aanlktin4cjw=smw00=1nlkt8ftmys6xtnvtrve_j9...@mail.gmail.com Content-Type: text/plain; charset=UTF-8 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 IndexNode(line# 45) 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 IndexNode 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 -- Mattias Persson, [matt...@neotechnology.com] Hacker, Neo Technology www.neotechnology.com -- 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] IndexProvider question
I would like to set AND as the default operator when I create index using the new index library: Index = indexProvider.nodeIndex( fulltext, LuceneIndexProvider.FULLTEXT_CONFIG ); I didn't find setDefaultOperator (similar to the one in LuceneFulltextQueryIndexService )in any of the provider classes. Is it supported in the new index provider? if not, is there a way we can set the same? Thanks in advance. --- On Thu, 9/9/10, Honnur Vorvoi vhon...@yahoo.com wrote: From: Honnur Vorvoi vhon...@yahoo.com Subject: Re: [Neo4j] IndexProvider question To: user@lists.neo4j.org Date: Thursday, September 9, 2010, 10:33 PM Thanks Mattias. Since IndexProvider does all LuceneFulltextQueryIndexService can do and much more, I am going to use just IndexProvider. Date: Wed, 8 Sep 2010 16:28:56 +0200 From: Mattias Persson matt...@neotechnology.com Subject: Re: [Neo4j] IndexProvider question To: Neo4j user discussions user@lists.neo4j.org Message-ID: aanlktin4cjw=smw00=1nlkt8ftmys6xtnvtrve_j9...@mail.gmail.com Content-Type: text/plain; charset=UTF-8 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 IndexNode(line# 45) 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 IndexNode 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
Re: [Neo4j] IndexProvider question
2010/9/10, Honnur Vorvoi vhon...@yahoo.com: I would like to set AND as the default operator when I create index using the new index library: Index = indexProvider.nodeIndex( fulltext, LuceneIndexProvider.FULLTEXT_CONFIG ); I didn't find setDefaultOperator (similar to the one in LuceneFulltextQueryIndexService )in any of the provider classes. Is it supported in the new index provider? if not, is there a way we can set the same? Thanks in advance. That functionality is easy to add, I just haven't gotten around to do it. I'll try to add that as soon as possible. Excellent feedback on the new IndexProvider framework, keep it coming! --- On Thu, 9/9/10, Honnur Vorvoi vhon...@yahoo.com wrote: From: Honnur Vorvoi vhon...@yahoo.com Subject: Re: [Neo4j] IndexProvider question To: user@lists.neo4j.org Date: Thursday, September 9, 2010, 10:33 PM Thanks Mattias. Since IndexProvider does all LuceneFulltextQueryIndexService can do and much more, I am going to use just IndexProvider. Date: Wed, 8 Sep 2010 16:28:56 +0200 From: Mattias Persson matt...@neotechnology.com Subject: Re: [Neo4j] IndexProvider question To: Neo4j user discussions user@lists.neo4j.org Message-ID: aanlktin4cjw=smw00=1nlkt8ftmys6xtnvtrve_j9...@mail.gmail.com Content-Type: text/plain; charset=UTF-8 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 IndexNode(line# 45) 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 IndexNode 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 -- 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] IndexProvider question
Thanks Mattias. Since IndexProvider does all LuceneFulltextQueryIndexService can do and much more, I am going to use just IndexProvider. Date: Wed, 8 Sep 2010 16:28:56 +0200 From: Mattias Persson matt...@neotechnology.com Subject: Re: [Neo4j] IndexProvider question To: Neo4j user discussions user@lists.neo4j.org Message-ID: aanlktin4cjw=smw00=1nlkt8ftmys6xtnvtrve_j9...@mail.gmail.com Content-Type: text/plain; charset=UTF-8 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 IndexNode(line# 45) 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 IndexNode 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
Re: [Neo4j] IndexProvider question
Honnur, I am not really sure I get everything right, but some hints inline: On Mon, Sep 6, 2010 at 2:56 AM, Honnur Vorvoi vhon...@yahoo.com wrote: 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? No, the indexing components are not blocking each other, so you should be fine having multiple indexing systems on the same graphdb instance. Anyway, let us know if you have any problems with that. 2. What doesn the param users in provider.nodeIndex(users) represent? The new indexing components support the notion of many parallel indexes that may be used for specialized tasks (e.g. fulltext, R-Trees, Spatial etc indexes). In order to get one of these, you register and look them up by name. The LuceneIndexProvider is registering under lucene, see https://svn.neo4j.org/laboratory/components/lucene-index/trunk/src/main/java/org/neo4j/index/impl/lucene/LuceneIndexProvider.java 3. Do I need to add all the properties in IndexNode(line# 45) in order to query? (I have already index the same properties with LuceneFulltextQueryIndexService) Well, depends on the type of index service you are using. With the new LuceneIndexProvider, you can do all sorts of full Lucene queries, look into the test https://svn.neo4j.org/laboratory/components/lucene-index/trunk/src/test/java/org/neo4j/index/impl/lucene/TestLuceneIndex.java for a lot of details on that. 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. in that test, method makeSureCompositeQueriesCanBeAsked, you can see index.query( username:*...@matrix AND sex:male ) which might be what you are looking for? /peter ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] IndexProvider question
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 IndexNode(line# 45) 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 IndexNode 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
Re: [Neo4j] IndexProvider question
Peter, Thank you very much. Your response answered all my questions. Regards, Honnur Date: Wed, 8 Sep 2010 14:54:55 +0200 From: Peter Neubauer peter.neuba...@neotechnology.com Subject: Re: [Neo4j] IndexProvider question To: Neo4j user discussions user@lists.neo4j.org Message-ID: aanlktiktcjo=rre=a8d06mnf4atg1ctecxnqvwa3z...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 Honnur, I am not really sure I get everything right, but some hints inline: On Mon, Sep 6, 2010 at 2:56 AM, Honnur Vorvoi vhon...@yahoo.com wrote: 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? No, the indexing components are not blocking each other, so you should be fine having multiple indexing systems on the same graphdb instance. Anyway, let us know if you have any problems with that. 2. What doesn the param users?in provider.nodeIndex(users) represent? The new indexing components support the notion of many parallel indexes that may be used for specialized tasks (e.g. fulltext, R-Trees, Spatial etc indexes). In order to get one of these, you register and look them up by name. The LuceneIndexProvider is registering under lucene, see https://svn.neo4j.org/laboratory/components/lucene-index/trunk/src/main/java/org/neo4j/index/impl/lucene/LuceneIndexProvider.java 3. Do I need to add all the properties in IndexNode(line# 45)?in order to query? (I have already index the same properties with LuceneFulltextQueryIndexService) Well, depends on the type of index service you are using. With the new LuceneIndexProvider, you can do all sorts of full Lucene queries, look into the test https://svn.neo4j.org/laboratory/components/lucene-index/trunk/src/test/java/org/neo4j/index/impl/lucene/TestLuceneIndex.java for a lot of details on that. 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. in that test, method?makeSureCompositeQueriesCanBeAsked, you can see ?index.query( username:*...@matrix AND sex:male ) which might be??what you are looking for? /peter ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user