After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 721880 - fts:offsets returns wrong values
fts:offsets returns wrong values
Status: RESOLVED FIXED
Product: tracker
Classification: Core
Component: FTS
git master
Other Linux
: Normal normal
: ---
Assigned To: tracker-general
Depends on:
Blocks:
 
 
Reported: 2014-01-09 18:02 UTC by Sam Thursfield
Modified: 2014-01-21 11:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix fts:offsets() (7.96 KB, patch)
2014-01-09 18:03 UTC, Sam Thursfield
committed Details | Review

Description Sam Thursfield 2014-01-09 18:02:53 UTC
While investigating the FTS functional-tests failures, I discovered that since the fts4 branch was merged fts:offsets has been broken. See patch for details.

This fix requires that we record the 'fulltext-indexed' property in the GVDB ontology cache; it would be nice if there was a way to force this to be recreated on existing installations, but since fts:offset is broken either way I'm not sure if it matters.
Comment 1 Sam Thursfield 2014-01-09 18:03:39 UTC
Created attachment 265865 [details] [review]
Fix fts:offsets()

Since the fts4 branch was merged, the fts:offsets() function has been
broken, because it assumed that properties were stored in the 'fts' table
in ID order but this was no longer the case.

The property names list is now created on init as static data, but this
requires having the 'fulltext_indexed' property available in all cases
where previously it has only been available if the ontologies were loaded
directly rather than from the GVDB cache.

tests/functional-tests/03-fts-functions.py has been improved to test the
fts:offsets() function more thoroughly.
Comment 2 Carlos Garnacho 2014-01-20 22:55:13 UTC
Comment on attachment 265865 [details] [review]
Fix fts:offsets()

Ugh, very nice catch Sam. I remember that relying on that sort of implicit ordering felt quite weak at the time, this looks indeed nicer.

Just one nitpick:
+	ptr = property_names = g_new0(gchar *, g_list_length (columns));
+	while (columns) {
+		*ptr = g_strdup(columns->data);

Missing spaces after g_new0 and g_strdup
Comment 3 Sam Thursfield 2014-01-21 11:43:43 UTC
Review of attachment 265865 [details] [review]:

Committed with those two fixups, thanks!