-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: [Search] Manual indexing & deleted items
PostPosted: Mon May 09, 2011 7:54 am 
Beginner
Beginner

Joined: Tue May 11, 2004 12:20 am
Posts: 33
Hi,

We have manual indexing (annoying, but its an existing old system, hard to re-design).
So our Entities have a "modifiedTime" property, and we periodically query for entities with "modifiedTime>X", and index them.

But obviously this approach fails for *deleted* items (they just don't come up in the query).
In the old system nobody minded, because database deletes were rare.
Now it's required, and I considered 2 approaches:
A) Using logical delete (don't delete the record, just mark it with some flag).
B) Maintaining a special table of "deleted entity IDs", so that every "DELETE" will trigger a insertion to this table.
C) I'd appreciate any other ideas as well.

Could I please ask what's best from the perspective of Hibernate Search?
1) Are there any subtle design/performance reasons, making one approach better for Hibernate Search?
2) Does Hibernate Search have built-in utilities for it? E.g. built-in flag or event that would cause Hibernate Search to automatically delete those records from the database once they've been indexed (since those records are kept just of the sake of indexing).

Thanks :)


Top
 Profile  
 
 Post subject: Re: [Search] Manual indexing & deleted items
PostPosted: Mon May 09, 2011 8:51 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
even if you had a search hit including a deleted entity, this won't show up: it will be skipped, so you don't need to do anything in "real time".

You could write a small utility which iterates on all elements of the index using projection on (class,id) and for those not existing in the database you use purge to delete them from the index.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: [Search] Manual indexing & deleted items
PostPosted: Sun May 15, 2011 12:12 pm 
Beginner
Beginner

Joined: Tue May 11, 2004 12:20 am
Posts: 33
Cool. Of course you're correct (since, luckily, we don't use Projection).
Thanks very much.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.