[Kazehakase-cvs] CVS update: kazehakase/module/search

Back to archive index

Hiroyuki Ikezoe ikezo****@users*****
Sun Dec 3 19:24:15 JST 2006


Index: kazehakase/module/search/kz-search-hyper-estraier.c
diff -u kazehakase/module/search/kz-search-hyper-estraier.c:1.3 kazehakase/module/search/kz-search-hyper-estraier.c:1.4
--- kazehakase/module/search/kz-search-hyper-estraier.c:1.3	Sun Dec  3 19:05:49 2006
+++ kazehakase/module/search/kz-search-hyper-estraier.c	Sun Dec  3 19:24:15 2006
@@ -87,7 +87,8 @@
 /* KzSearch Class */
 static gchar	  *get_search_result_html     (KzSearch *search, const gchar *text);
 static KzBookmark *get_search_result_bookmark (KzSearch *search, const gchar *text);
-static gboolean    register_document          (KzSearch *search, const gchar *filename);
+static gboolean    register_document          (KzSearch *search, const gchar *uri);
+static gboolean    unregister_document        (KzSearch *search, const gchar *uri);
 static gboolean    update_index		      (KzSearch *search);
 static gboolean    purge_index		      (KzSearch *search);
 static GPid        optimize_index             (KzSearch *search);
@@ -162,6 +163,7 @@
 	search_class->get_search_result_html     = get_search_result_html;
 	search_class->get_search_result_bookmark = get_search_result_bookmark;
 	search_class->register_document          = register_document;
+	search_class->unregister_document        = unregister_document;
 	search_class->update_index               = update_index;
 	search_class->purge_index                = purge_index;
 	search_class->optimize_index             = optimize_index;
@@ -398,14 +400,45 @@
 }
 
 gboolean
-register_document (KzSearch *search, const gchar *filename)
+register_document (KzSearch *search, const gchar *uri)
 {
-	g_idle_add (_update_index, (gpointer)filename);
+	g_idle_add (_update_index, (gpointer)uri);
 
 	return TRUE;
 }
 
 gboolean
+unregister_document (KzSearch *search, const gchar *uri)
+{
+	ESTDB *db;
+	int id, ret, ecode, success;
+	gchar *dbname;
+
+	dbname = g_strdup_printf("%s%s", g_get_home_dir(), HISTORY_INDEX);
+	db = est_db_open(dbname, ESTDBREADER, &ecode);
+	g_free(dbname);
+	if (!db)
+	{
+		g_warning("error: %s", est_err_msg(ecode));
+		return FALSE;
+	}
+
+	id = est_db_uri_to_id(db, uri);
+	if (id == -1)
+		return FALSE;
+	success = est_db_out_doc(db, id, ESTODCLEAN);
+
+	ret = est_db_close(db, &ecode);
+	if (!ret)
+	{
+		g_warning("error: %s", est_err_msg(ecode));
+	}
+
+
+	return (success != 0) ? TRUE : FALSE;
+}
+
+gboolean
 update_index (KzSearch *search)
 {
 	return TRUE;


More information about the Kazehakase-cvs mailing list
Back to archive index