There are mechanisms implemented to help you out there, which are:

* If a non-existent node/relationship is encountered during a query it will
be ignored as well as added to a delete-later-list.
* When a write transaction is about to commit, any items in the
delete-later-list will be added to it as well, deleting them for real from
the index.

These two help clean up the index, but you should try to do it pro-actively
yourself... or, of course there's auto-indexing.

2011/9/7 Nuo Yan <[email protected]>

> Thanks. That was what I imagined too. However, I have a test that does:
>
> 1. create two nodes (e.g. node 2 and node 3)
> 2. create a relationship between the two nodes (e.g. rel id 23, type :foo)
> 3. add the relationship to the foo_rels index, with 2 as the key, 3 as the
> value (the node ids) on rel id 23.
> (In REST it's a POST to /index/relationship/foo_rels/2/3 with the URI of
> the relationship 23 as the body)
> 4. look up the relationship from the index, returned expected result (GET
> to /index/relationship/foo_rels/2/3).
> 5. delete the relationship (id 23) (a DELETE to /relationship/23)
> 6. look up the relationship from the index again (GET to
> /index/relationship/foo_rels/2/3), returned empty results ([]).
>
> The result of the test confused me. It appears that the relationship was
> also removed from the index (as step 6 returned empty array) when it was
> deleted.
>
> Any insights?
>
>
>
>
> On Sep 6, 2011, at 7:05 PM, Linan Wang wrote:
>
> > as far as i know, no. you need to do it yourself.
> > hint: http://docs.neo4j.org/chunked/1.4.1/indexing-update.html
> >
> > On Wed, Sep 7, 2011 at 1:25 AM, Nuo Yan <[email protected]> wrote:
> >> Hey guys,
> >>
> >> When a relationship gets deleted, will it be removed from the index
> >> automatically? My test shows yes, but I want to be absolutely certain.
> >>
> >> For example, a relationship :foo exists between node A and B and it's
> >> indexed on the foo_rels index with key node_a's id and value node_b's
> id.
> >> When I delete this relationship, do I also have to manually remove it
> from
> >> the index (i.e. a DELETE to /index/relationship/foo_rels/15/23/100 where
> 15
> >> is the key, 23 is the value, 100 is the relationship id)?
> >> _______________________________________________
> >> Neo4j mailing list
> >> [email protected]
> >> https://lists.neo4j.org/mailman/listinfo/user
> >>
> >
> >
> >
> > --
> > Best regards
> >
> > Linan Wang
> > _______________________________________________
> > Neo4j mailing list
> > [email protected]
> > https://lists.neo4j.org/mailman/listinfo/user
>
> _______________________________________________
> Neo4j mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Mattias Persson, [[email protected]]
Hacker, Neo Technology
www.neotechnology.com
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to