Re: [Neo4j] LuceneIndexProvider EXACT_CONFIG vs. FULLTEXT_CONFIG

2010-10-31 Thread Mattias Persson
Have you looked at the lucene documentation? Neo4j doesn't touch any of
that, it lets Lucene do the sorting. Do your values have lots of words in
them (snippets of text)? You could probably copy-paste the exception message
and google it!

2010/10/29 Konstanze.Lorenz 

> Sorry for the brackets. In my test, they weren't there!
> Thank you for fixing the problem. It works much better.
> Now I have an additional question: sorting a result.
> Is it possible to sort fulltext results when the values do have space
> characters? Currently I get an exception, that the field has too much tokens
> to be sorted.
> I'm expecting that sort will look in the queryresult for the whole field
> value (not only its tokens) and sort it then.
>
> -Ursprüngliche Nachricht-
> Von: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] Im
> Auftrag von Mattias Persson
> Gesendet: Dienstag, 26. Oktober 2010 13:34
> An: Neo4j user discussions
> Betreff: Re: [Neo4j] LuceneIndexProvider EXACT_CONFIG vs. FULLTEXT_CONFIG
>
> I just found the problem... fulltext defaults to being case-insensitive (by
> converting added values as well as string queries to lower case). There's a
> quirk in the Lucene QueryParser where you must specifically set whether or
> not range/wildcard queries should have their terms converted into lower
> case
> or not, and by that ignoring what the analyzer has to say about it, which I
> feel is a poor design decision in Lucene. Because now if you specify your
> own custom analyzer class in the configuration you must also set the
> "to_lower_case" parameter to how the analyzer is implemented, otherwise you
> cannot expect to get the correct results back. Anyways, range/wildcard
> terms
> are lower cased more correctly now.
>
> Your queries will work with the latest SNAPSHOT, however your second query
> doesn't look like a proper lucene query. Maybe you meant "Arn*" w/o the
> brackets?
>
> Main difference between "exact" and "fulltext" is that a fulltext index
> tokenizes your values into words and indexes each word individually (and
> also by default converting them into lower case).
>
> 2010/10/26 Konstanze.Lorenz 
>
> > Hello,
> > I'm giving the new LuceneIndexProvider a trial und try to become
> acquainted
> > with EXACT_CONFIG and FULLTEXT_CONFIG. Currently, I do not understand
> some
> > differences between their quering-results..
> > For example:
> > String nameArnold = "Arnold Aronson";
> >   String key = "name";
> >
> > Node nodeArnold = neo.createNode();
> > nodeArnold.setProperty(key, nameArnold);
> >   index.add(nodeArnold, key, nameArnold);
> > --
> > index.query(key, "[A TO Z]"; //(1)
> > index.query(key, "[Arn*]"; //(2)
> >
> > These querys work only with EXACT. FULLTEXT returns no matches. But a
> > RangeQuery (1) for String would be quiet interesting with FULLTEXT. It
> > should return the same matches as EXACT at least. Furthermore, the Query
> > Parser Syntax of Lucene should be enabled in FULLTEXT (2).
> > So here is the question: Am I not seeing the trick to use them similarly
> or
> > are these configurations that different as they seem to be?
> > ___
> > 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] Delete a RelationshipType

2010-10-31 Thread Mattias Persson
2010/10/31 Craig Taverner 

> A db restart is required to start reusing free'd ids? Seems a bit drastic.
> I
> hope it happens sooner than that.
>

As far as I know no id's are reused during one lifecycle of an
EmbeddedGraphDatabase. It needs to be restarted to be able to "discover" old
deleted ids and reuse them. However that is just the current implementation,
it might change in the future.


> ___
> 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] Delete a RelationshipType

2010-10-31 Thread Craig Taverner
A db restart is required to start reusing free'd ids? Seems a bit drastic. I
hope it happens sooner than that.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Delete a RelationshipType

2010-10-31 Thread Chris Gioran
> My understanding is this:

And it is wrong. Consider the following snippet:

GraphDatabaseService graphDb = new EmbeddedGraphDatabase("var/base");

Transaction tx = graphDb.beginTx();

Node firstNode = graphDb.createNode();
Node secondNode = graphDb.createNode();
System.out.println(firstNode.getId());
System.out.println(secondNode.getId());
secondNode.delete();
Node thirdNode = graphDb.createNode();
System.out.println(thirdNode.getId());
tx.success();
tx.finish();

tx = graphDb.beginTx();
Node fourthNode = graphDb.createNode();
System.out.println(fourthNode.getId());
tx.success();
tx.finish();
graphDb.shutdown();

If the id pool was reused after a successful commit() (success() in
the above code) as I described then, on a new db, this should print
1
2
3
2

but instead it prints
1
2
3
4

The id 2 is reused upon restart of the db.
That will teach me to speak without checking first. What I did wrong
is left as an exercise for tomorrow.

cheers,
CG
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Delete a RelationshipType

2010-10-31 Thread Chris Gioran
> I am curious, are there any 'developer tricks' for influencing when old
> slots are reused? For example, instead of adding the new relationships
> immediately after deleting old ones, but keeping a cache of 'relationships
> to add' and adding them a little later. Will that increase the chance of old
> slots being reused?

My understanding is this:
An id for every record and, correspondingly, a number of bytes in the
file, are reserved the moment that, during a tx, a new entity is
created. Conversely, the id of an entity is freed upon successful
commit() of the tx that deleted it, although the space is still
occupied but marked as free and available to be returned at the next
request for a new entity. Note that all these operations have entity
type scope, meaning that a freed Node does not in any way influence
Relationship operations.
The above lead to a strategy of performing and committing any deletes
first and then, in a new tx, create all that is needed. If, during the
same tx, a delete is made and then a create, the deleted id is not
reused.

> I think this is relevant to cases where the developer wants to keep the
> database reasonably compact but does large amounts of deletion and creation.

I think there was a similar discussion here some time ago and I seem
to recall that the proposed solution for compacting a db after a long
streak of deletes/inserts was to recreate the db in a new location.

Hope that helps somewhat.

cheers,
CG
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Delete a RelationshipType

2010-10-31 Thread Craig Taverner
>
> I think this is because the storage slots of the old relationships is
> not "compacted" but will be reused for new relationships in the future.
>

I am curious, are there any 'developer tricks' for influencing when old
slots are reused? For example, instead of adding the new relationships
immediately after deleting old ones, but keeping a cache of 'relationships
to add' and adding them a little later. Will that increase the chance of old
slots being reused?

I think this is relevant to cases where the developer wants to keep the
database reasonably compact but does large amounts of deletion and creation.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Delete a RelationshipType

2010-10-31 Thread Anders Nawroth
Hi!

> After running, size of the graph is changed from 2GB to 3.5GB

I think this is because the storage slots of the old relationships is 
not "compacted" but will be reused for new relationships in the future.

> and when I print
> the relationship types with:
>
>  System.out.println("\tRelationship types:");
>  for (Iterator  rel_type_itr =
> graphDb.getRelationshipTypes().iterator(); rel_type_itr
>  .hasNext();)
>  System.out.println("\t\t" + rel_type_itr.next().name());
>
> R1, R2 and R3 are in the output. Why?

The answer is in the javadocs:
http://api.neo4j.org/current/org/neo4j/graphdb/GraphDatabaseService.html#getRelationshipTypes%28%29

"Note that this method is guaranteed to return all known relationship 
types, but it does not guarantee that it won't return more than that 
(e.g. it can return "historic" relationship types that no longer have 
any relationships in the node space)."


/anders


>
> I checked all node's relations, there is no relation which its type is equal 
> to
> R1 or R2!
>
> Kind regards
>
>
>
>
> ___
> 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