Hi,
These are flaws in the documentation, great that you point them out.
1. It probably should not say "re-create an already existing index", but
rather "restore an already existing index",
The old index will not be removed, it will rather be loaded again from the
index-tree in the graph.
2. You are correct in that when passing null as the name of the index an
IllegalArgumentException will be thrown,
We should remove the part in the documentation that states that you can
pass null for the name.
There isn't really a case where you want to pass null as the name. Since you
always use the same code for instantiating the index, each time you execute
your application you will always pass in the name anyway. The cases are:
* The index does not exist => it gets created with the given name
* the index exists:
* The given name is the same as the stored name => this is the exepected
index, all is ok, load the index
* The given name differs from the stored one => you were expecting a
different index, throw an exception rather than work with the wrong index.
I will update the documentation, it will take a short while before it makes
it out to the servers.
Cheers,
Tobias
On Fri, Nov 20, 2009 at 4:12 PM, Laurent Laborde <[email protected]>wrote:
> Meep !
> Another problem with the documentation.
> I'm not sure to understand : http://components.neo4j.org/index-util/
>
> // re-create an already existing index
> Node indexNode = //... get the underlying index node
> // we can pass in null as name if the index already exist (name will
> then
> // be loaded from the underlying node)
> Index myIndex = new SingleValueIndex( null, indexNode, neo );
>
> Does it delete the old index and recreate from scratch ?
>
> What if i want to add more node in this index when i relaunch the app
> to add new data ?
> eg :
> Run 1 :
> "This is the first run"
> "initialize some stuff"
> "create index"
> loop
> "create node" + "index node" + "create relationship"
> endloop
> "clean shutdown"
>
> Run 2:
> "not the first run"
> "get some info about last job"
> "get the index node"
> loop
> check in index if a node with the same "myProperty" already exist
> if exist : next loop;
> else : "create node" + "index node" + "create relationship"
> endloop
> clean shutdown
>
> How... and BTW : using null ad index name raise an
> IllegalArgumentException.
>
> --
> ker2x
> _______________________________________________
> Neo mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
>
--
Tobias Ivarsson <[email protected]>
Hacker, Neo Technology
www.neotechnology.com
Cellphone: +46 706 534857
_______________________________________________
Neo mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user