[Neo4j] Why node's index entry can not be removed from lucene index after the node is deleted from the graph

Samuel Feng okosioc at gmail.com
Tue Dec 14 11:13:38 CET 2010


Thanks Luanne,

My case:

I indexed several properties on one node, but I missed to remove one
property(say, property A) before node.delete().

In such case, seems the index document will not deleted correctly. Although
the original document is marked deleted in Luke, but it is strange that a
new document with the property A is created using the same _id_.

I further encountered a transaction exception, When this node id is
re-assigned to a new node......

So the correct way to delete a node should be removing all the index before
invoking delete(). Right?


2010/12/14 Luanne Misquitta <LMisquitta at saba.com>

> That's strange. I indexed a single property on two nodes, and then used
> remove method on the index to remove that property- then checked in Luke,
> and the documents appear to be there, but marked deleted. I could undelete
> them also via Luke. When I did a Luke->Optimize index, then the documents
> were well and truly deleted. Not sure what the intended behavior of the
> index remove is now that you bring this up.
>
> Regards
>
> Luanne M.
> Tech Lead
>
> twitter / @luannem
> linkedin / http://in.linkedin.com/in/luannemisquitta
> skype / luanne.misquitta
> blog / http://thought-bytes.blogspot.com/
> Saba. Power Up Your People.
>
>
> -----Original Message-----
> From: user-bounces at lists.neo4j.org [mailto:user-bounces at lists.neo4j.org]
> On Behalf Of Samuel Feng
> Sent: Tuesday, December 14, 2010 12:31 PM
> To: Neo4j user discussions
> Subject: Re: [Neo4j] Why node's index entry can not be removed from lucene
> index after the node is deleted from the graph
>
> I checked the index.remove(), it can only delete the key filed from the
> node
> entry in index. (The node entry is a document in lucene index)
>
> The node entry is still there....
>
> 2010/12/14 Luanne Misquitta <LMisquitta at saba.com>
>
> > You could perhaps also delete the data from the index using:
> > Index.remove(T entity, String key, Object value)
> >
> > However, I assume that if you've added x properties of the node to the
> > index, you'd have to remove all those X properties?
> >
> > Regards
> > Luanne M.
> > Tech Lead
> >
> > twitter / @luannem
> > linkedin / http://in.linkedin.com/in/luannemisquitta
> > skype / luanne.misquitta
> > blog / http://thought-bytes.blogspot.com/
> > Saba. Power Up Your People.
> >
> >
> > -----Original Message-----
> > From: user-bounces at lists.neo4j.org [mailto:user-bounces at lists.neo4j.org]
> > On Behalf Of Samuel Feng
> > Sent: Tuesday, December 14, 2010 12:11 PM
> > To: Neo4j user discussions
> > Subject: [Neo4j] Why node's index entry can not be removed from lucene
> > index after the node is deleted from the graph
> >
> > Dears,
> >
> > Index<Node> persons = graphDb.index().forNodes( "persons" );
> > Node firstPerson = graphDb.createNode();
> > Node secondPerson = graphDb.createNode();
> > persons.add( firstPerson, "name", "Mattias Persson" );
> >
> > Now I have to delete the firstPerson node from the graph.
> > i.e firstPerson.delete()
> >
> > After the transaction committed, the node is deleted from the graph.
> > However, I then further check the lucene index using "LUKE", still can
> find
> > the node's entry in it.
> >
> > I understand that this node entry will not affect the query result of
> > neo4j.
> > But If my graph has many deletions, there will produce a lot
> > of obsoleted node entry in lucene index.
> >
> > Do u have any ideas that how I can delete this obsoleted index entries or
> > neo4j has some other mechanism to do this?
> > _______________________________________________
> > 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