Here's my view on it. I think that the current method names are a little
more fluent, like you're writing a sentence:

   // give me an index for nodes called "persons"
   graphDb.index().forNodes( "persons" )

instead of

   given me the index manager and let it give me the node index called
"persons"
   graphDb.getIndexManager().getNodeIndex( "persons" )

which is more verbose and doesn't give me more information IMHO. It's a
matter of taste in the end though.

2010/11/3 Hans Brattberg <hans.brattb...@crisp.se>

> Hi!
>
> I just starting to learn Neo4j and here are some feedback from a
> newbie on the index() stuff on the GraphDatabaseService.
> (I hop I got it right)
>
> I think the naming of some of the functions is a bit confusing.
>
> To add a node to a node index, indexing some property would look something
> like
> graphDatabaseService.index().forNodes("indexname").add(aNode,
> "property", "value");
>
> When I first read "index()" I read it as a verb. Like "start to index
> stuff".
> And it surprices me that it doesn't return an Index, it returns an
> IndexManager.
> Why don't you just name it "getIndexManager()"?
>
> And what does "forNodes" mean?
> What it does is to get/create an index.
> But wait, didn't the index() method do this?
> Hmm, a little bit confusing.
> What if the forNodes was named "getNodeIndex" or "getIndexForNodes"
> instead?
>
> When I combine these suggestions I get
>
> graphDbService.getIndexManager().getNodeIndex("indexname").add(aNode,
> "property", "value");
>
> instead of:
> graphDbService.index().forNodes("indexname").add(aNode, "message",
> "Hello");
>
> Just my 5 cents.
> /Hans
>
> --
> Hans Brattberg
> hans.brattb...@crisp.se
> www.crisp.se/hans.brattberg
> +46 (0)70 575 31 32
> _______________________________________________
> 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

Reply via email to