tracker r1969 - in branches/indexer-split: . src/libtracker-common utils/qdbm
- From: ifrade svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1969 - in branches/indexer-split: . src/libtracker-common utils/qdbm
- Date: Thu, 31 Jul 2008 12:56:50 +0000 (UTC)
Author: ifrade
Date: Thu Jul 31 12:56:50 2008
New Revision: 1969
URL: http://svn.gnome.org/viewvc/tracker?rev=1969&view=rev
Log:
Using common tracker-index-item struct instead local copy
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/src/libtracker-common/tracker-index-item.c
branches/indexer-split/src/libtracker-common/tracker-index-item.h
branches/indexer-split/utils/qdbm/Makefile.am
branches/indexer-split/utils/qdbm/print-words.c
Modified: branches/indexer-split/src/libtracker-common/tracker-index-item.c
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-index-item.c (original)
+++ branches/indexer-split/src/libtracker-common/tracker-index-item.c Thu Jul 31 12:56:50 2008
@@ -47,3 +47,9 @@
return (gint16) (a[0] << 8) | (a[1]);
}
+
+guint32
+tracker_index_item_get_id (TrackerIndexItem *item)
+{
+ return item->id;
+}
Modified: branches/indexer-split/src/libtracker-common/tracker-index-item.h
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-index-item.h (original)
+++ branches/indexer-split/src/libtracker-common/tracker-index-item.h Thu Jul 31 12:56:50 2008
@@ -19,7 +19,7 @@
gint score);
guint8 tracker_index_item_get_service_type (TrackerIndexItem *details);
gint16 tracker_index_item_get_score (TrackerIndexItem *details);
-
+guint32 tracker_index_item_get_id (TrackerIndexItem *details);
G_END_DECLS
Modified: branches/indexer-split/utils/qdbm/Makefile.am
==============================================================================
--- branches/indexer-split/utils/qdbm/Makefile.am (original)
+++ branches/indexer-split/utils/qdbm/Makefile.am Thu Jul 31 12:56:50 2008
@@ -1,20 +1,23 @@
noinst_PROGRAMS = print search
-INCLUDES = \
- $(QDBM_CFLAGS) \
+INCLUDES = \
+ -DG_LOG_DOMAIN=\"Tracker\" \
+ -I$(top_srcdir)/src \
+ $(QDBM_CFLAGS) \
$(GLIB2_CFLAGS)
print_SOURCES = \
print-words.c
-print_LDADD = \
- $(QDBM_LIBS) \
+print_LDADD = \
+ $(top_builddir)/src/libtracker-common/libtracker-common.la \
+ $(QDBM_LIBS) \
$(GLIB2_LIBS)
search_SOURCES = \
search-word.c
-search_LDADD = \
+search_LDADD = \
$(QDBM_LIBS) \
$(GLIB2_LIBS)
Modified: branches/indexer-split/utils/qdbm/print-words.c
==============================================================================
--- branches/indexer-split/utils/qdbm/print-words.c (original)
+++ branches/indexer-split/utils/qdbm/print-words.c Thu Jul 31 12:56:50 2008
@@ -1,5 +1,6 @@
#include <depot.h>
#include <glib.h>
+#include <libtracker-common/tracker-index-item.h>
#define USAGE "Usage: print -f qdbm-file\n"
@@ -19,24 +20,14 @@
};
-typedef struct {
- /* Service ID number of the document */
- guint32 id;
-
- /* Amalgamation of service_type and score of the word in the
- * document's metadata.
- */
- gint amalgamated;
-} TrackerIndexerWordDetails;
-
-TrackerIndexerWordDetails *
+TrackerIndexItem *
tracker_indexer_get_word_hits (DEPOT *index,
const gchar *word,
guint *count)
{
- TrackerIndexerWordDetails *details;
- gint tsiz;
- gchar *tmp;
+ TrackerIndexItem *details;
+ gint tsiz;
+ gchar *tmp;
g_return_val_if_fail (word != NULL, NULL);
@@ -47,11 +38,11 @@
}
if ((tmp = dpget (index, word, -1, 0, 100, &tsiz)) != NULL) {
- if (tsiz >= (gint) sizeof (TrackerIndexerWordDetails)) {
- details = (TrackerIndexerWordDetails *) tmp;
+ if (tsiz >= (gint) sizeof (TrackerIndexItem)) {
+ details = (TrackerIndexItem *) tmp;
if (count) {
- *count = tsiz / sizeof (TrackerIndexerWordDetails);
+ *count = tsiz / sizeof (TrackerIndexItem);
}
}
}
@@ -59,24 +50,14 @@
return details;
}
-
-guint8
-tracker_indexer_word_details_get_service_type (TrackerIndexerWordDetails *details)
-{
- g_return_val_if_fail (details != NULL, 0);
-
- return (details->amalgamated >> 24) & 0xFF;
-}
-
-
void
load_terms_from_index (gchar* filename){
DEPOT *depot;
char *key;
int counter = 0, start_time, total_time;
- gint hits, i;
- TrackerIndexerWordDetails *results;
+ guint hits, i;
+ TrackerIndexItem *results;
depot = dpopen (filename, DP_OREADER | DP_ONOLCK, -1);
@@ -98,9 +79,10 @@
if (print_services) {
results = tracker_indexer_get_word_hits (depot, key, &hits);
for (i = 0; i < hits; i++) {
- g_print (" (id:%d t:%d) ",
- results[i].id,
- tracker_indexer_word_details_get_service_type (&results[i]));
+ g_print (" (id:%d t:%d s:%d) ",
+ tracker_index_item_get_id (&results[i]),
+ tracker_index_item_get_service_type (&results[i]),
+ tracker_index_item_get_score (&results[i]));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]