[Neo4j] Query for combination of properties

Balazs E. Pataki pataki at dsd.sztaki.hu
Thu Jul 8 16:18:49 CEST 2010


A native solution would be also fine. This would practically allow, what 
is not really possible with the current relationship lookup 
implementation: to have really hundred thousands or millions of 
relationships to a Node and still be able to select relationships in a 
random access manner by some parameters (eg. relationship type, but 
maybe other properties as well).

Would such native indexing require modifications to the current database 
file format, or it could be implemented as an additional service?
---
balazs

On 7/8/10 4:11 PM, Mattias Persson wrote:
> No, (lucene) indexing won't be implemented into getRelationships (it would
> totally break performance). However there are possibilities to create some
> other type of indexing (on relationship type for example/direction)
> natively.
>
> 2010/7/8 Balazs E. Pataki<pataki at dsd.sztaki.hu>
>
>> Great, thanks!
>>
>> Do you have any info on when 1.1 is expected?
>>
>> In the meantime we will use this laboratory version of the
>> LuceneIndexProvider, because the multi-field search is essential in our
>> case.
>>
>> By the way: I see that now one can also index relationships with the new
>> API. Do you also plan to use these relationship indexes to make
>> Node#getRelationships() and similar functions faster? So far it seems
>> they look up relationships sequentially, which is pretty bad when you
>> want too look for a specific type of relationships among 10.000 others.
>> (OK, it is more of a problem with 1 million relationships, but anyway,
>> I'm just curious ;-) )
>> ---
>> balazs
>>
>> On 7/8/10 3:21 PM, Mattias Persson wrote:
>>> Yeah, that API isn't stable yet, but I think that it will end up similar
>> to
>>> that... and hopefully merged into kernel trunk after 1.1 sometime. You
>> can
>>> use it for fun, but you should expect changes in it.
>>>
>>> 2010/7/7 Peter Neubauer<peter.neubauer at neotechnology.com>
>>>
>>>> Balazs,
>>>> Mattias is writing this component, not sure how stable it is right
>>>> now, but as I perceived it the API is starting to settle ...
>>>>
>>>> Would be great to get some more indexes tried out, feel free to
>>>> experiment with Sphinx, might be a good alternative to Lucene?
>>>>
>>>> Cheers,
>>>>
>>>> /peter neubauer
>>>>
>>>> COO and Sales, Neo Technology
>>>>
>>>> GTalk:      neubauer.peter
>>>> Skype       peter.neubauer
>>>> Phone       +46 704 106975
>>>> LinkedIn   http://www.linkedin.com/in/neubauer
>>>> Twitter      http://twitter.com/peterneubauer
>>>>
>>>> http://www.neo4j.org               - Your high performance graph
>> database.
>>>> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
>>>>
>>>>
>>>>
>>>> On Wed, Jul 7, 2010 at 6:07 PM, Balazs E. Pataki<pataki at dsd.sztaki.hu>
>>>> wrote:
>>>>> That's great, works as expected. :-)
>>>>>
>>>>> Now, it seems you changed a lot of the indexing APIs. Should I use
>> these
>>>>> new ones (and the neo4j sources from the SVN trunk), as these will be
>>>>> used in future versions, or these are still experimental?
>>>>>
>>>>> I ask this because in parallel we also investigate the possibility of
>>>>> integrating the shynx indexer (http://www.sphinxsearch.com/) to neo4j.
>>>>> If there's any experience or plans regarding sphynx, I would appreciate
>>>>> any info about it.
>>>>>
>>>>> Thanks again,
>>>>> ---
>>>>> balazs
>>>>>
>>>>>
>>>>>
>>>>> On 7/7/10 3:40 PM, Peter Neubauer wrote:
>>>>>> Balazs,
>>>>>> this is not explicitly possible today, but in the new Lucene-Index
>>>>>> component in laboratory that will be integrated into trunk after Neo4j
>>>>>> 1.1, see
>>>>
>> https://svn.neo4j.org/laboratory/components/lucene-index/src/test/java/org/neo4j/index/impl/lucene/TestLuceneIndex.java
>>>> ,
>>>>>> method makeSureCompositeQueriesCanBeAsked .
>>>>>>
>>>>>> Sorry for the inconvenience! You could try out the component and let
>>>>>> us know if that works for you?
>>>>>>
>>>>>> Cheers,
>>>>>>
>>>>>> /peter neubauer
>>>>>>
>>>>>> COO and Sales, Neo Technology
>>>>>>
>>>>>> GTalk:      neubauer.peter
>>>>>> Skype       peter.neubauer
>>>>>> Phone       +46 704 106975
>>>>>> LinkedIn   http://www.linkedin.com/in/neubauer
>>>>>> Twitter      http://twitter.com/peterneubauer
>>>>>>
>>>>>> http://www.neo4j.org               - Your high performance graph
>>>> database.
>>>>>> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing
>> party.
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Wed, Jul 7, 2010 at 3:12 PM, Balazs E. Pataki<pataki at dsd.sztaki.hu
>>>
>>>>    wrote:
>>>>>>> Toni,
>>>>>>>
>>>>>>> thanks for the hints!
>>>>>>>
>>>>>>> Here's my actual use case:
>>>>>>>
>>>>>>> I have Nodes storing texts of various languages. The Nodes have 2
>>>>>>> properties:
>>>>>>>
>>>>>>>          content: the actual text
>>>>>>>
>>>>>>>          language: ISO language code of the text ("eng", "ger", "hun",
>>>> etc)
>>>>>>>
>>>>>>> I would like to search for Nodes containing a specific text in
>>>> "content"
>>>>>>> having a specific "language" code. With plain Lucene it would be
>>>>>>> something like:
>>>>>>>
>>>>>>>       content:"hello" AND language:"eng"
>>>>>>>
>>>>>>> to look for the word "hello" in an English language Node (actually a
>>>>>>> "Document" in Lucene).
>>>>>>>
>>>>>>> I think this is different from ranges, where you want to match a
>> single
>>>>>>> key matching a given range. Or am I mistaken?
>>>>>>> ---
>>>>>>> balazs
>>>>>>>
>>>>>>> On 7/7/10 2:59 PM, Toni Menzel wrote:
>>>>>>>> Balazs,
>>>>>>>> Check out LuceneFulltextQueryIndexService [1] and read at "Range
>>>>>>>> Queries" at [2].
>>>>>>>> This should give you what you are looking for if i understand that
>>>> correctly.
>>>>>>>>
>>>>>>>> Toni
>>>>>>>>
>>>>>>>> [1]
>>>>
>> http://components.neo4j.org/neo4j-index/apidocs/org/neo4j/index/lucene/LuceneFulltextQueryIndexService.html
>>>>>>>> [2]
>>>>
>> http://wiki.neo4j.org/content/Indexing_with_IndexService#A_great_subclass_to_LuceneFulltextIndexServic
>>>>>>>>
>>>>>>>> On Wed, Jul 7, 2010 at 2:39 PM, Balazs E. Pataki<
>> pataki at dsd.sztaki.hu>
>>>>      wrote:
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I'm new to neo4j and have read quite a lot of documentation and
>>>> source
>>>>>>>>> code and it seems that one can only do queries on a single Node
>>>> property
>>>>>>>>> (a single indexed value mapped to a key) using :
>>>>>>>>>
>>>>>>>>>         IndexHits<Node>      getNodes( String key, Object value )
>>>>>>>>>
>>>>>>>>> This seems to be true for LuceneFulltextIndexService as well: one
>> can
>>>>>>>>> only query for a single field.
>>>>>>>>>
>>>>>>>>> However, Lucene allows queries on multiple fields as well. As in
>> the
>>>>>>>>> Lucene examples
>>>>>>>>> (http://lucene.apache.org/java/2_4_0/queryparsersyntax.html#Fields
>> ):
>>>>>>>>>
>>>>>>>>>         title:"The Right Way" AND text:go
>>>>>>>>>
>>>>>>>>> This would find documents with a title field matching "The Right
>> Way"
>>>>>>>>> and a text field matching "go".
>>>>>>>>>
>>>>>>>>> Is it possible to do this in neo4j and the
>>>> LuceneFulltextIndexService?
>>>>>>>>>
>>>>>>>>> As far as I can seee, the answer is no. If it is the case, how
>>>> difficult
>>>>>>>>> would it be to add such multi field query to the
>>>> LuceneFulltextIndexService?
>>>>>>>>>
>>>>>>>>> Thanks for any help, or at least a confirmation that such multi
>> field
>>>>>>>>> Lucene query is possible or not witn neo4j 1.0.
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>> ---
>>>>>>>>> balazs
>>>>>>>>> _______________________________________________
>>>>>>>>> Neo4j mailing list
>>>>>>>>> User at lists.neo4j.org
>>>>>>>>> https://lists.neo4j.org/mailman/listinfo/user
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Neo4j mailing list
>>>>>>> User at lists.neo4j.org
>>>>>>> https://lists.neo4j.org/mailman/listinfo/user
>>>>>>>
>>>>>> _______________________________________________
>>>>>> Neo4j mailing list
>>>>>> User at lists.neo4j.org
>>>>>> https://lists.neo4j.org/mailman/listinfo/user
>>>>> _______________________________________________
>>>>> Neo4j mailing list
>>>>> User at lists.neo4j.org
>>>>> https://lists.neo4j.org/mailman/listinfo/user
>>>>>
>>>> _______________________________________________
>>>> Neo4j mailing list
>>>> User at lists.neo4j.org
>>>> https://lists.neo4j.org/mailman/listinfo/user
>>>>
>>>
>>>
>>>
>> _______________________________________________
>> Neo4j mailing list
>> User at lists.neo4j.org
>> https://lists.neo4j.org/mailman/listinfo/user
>>
>
>
>


More information about the User mailing list