Multiple FTS views or single FTS view?

14 views
Skip to first unread message

Brendan Duddridge

unread,
Jun 28, 2015, 3:10:28 AM6/28/15
to mobile-c...@googlegroups.com
Hi,

When you create a full text query view in Couchbase Lite, a single FTS virtual table is created as well as a "maps" view table. I thought if I were to create multiple full text query views I would get multiple FTS virtual tables in the SQLite database. I still only get one FTS table (called "fulltext"), but with multiple "maps" tables. I'm wondering that since I only seem to get one FTS table, is there really any advantage to creating multiple full text query views in order to get those multiple maps tables? Or is it just as good to create a single big full text query view for all the searchable values in my database?

I'm not really sure what the relationship to all the entries in the maps table are to the FTS table. It seems that all the keys are "null" and all the values are NULL in the maps table. How does the maps table get used in an FTS query? I would think the query would go directly to the FTS table and get the array of docids which can be used to get the documents.

I guess I'm just looking for a best practice to get the best performance. One full text query view or multiple full text query views broken up by some logical grouping within my app (in my case a set of records for a specific form).

Thanks,

Brendan

Jens Alfke

unread,
Jun 28, 2015, 7:51:59 PM6/28/15
to mobile-c...@googlegroups.com

On Jun 28, 2015, at 12:10 AM, Brendan Duddridge <bren...@gmail.com> wrote:

I guess I'm just looking for a best practice to get the best performance. One full text query view or multiple full text query views broken up by some logical grouping within my app (in my case a set of records for a specific form).

I would just structure it the way that makes sense for your app. If you put everything into one view, you’re probably going to get a ton of false positives for queries (i.e. places where the words were found but in the wrong fields of the document) and you’ll have to write extra code and take extra time to filter those out.

—Jens

Brendan Duddridge

unread,
Jun 28, 2015, 8:28:03 PM6/28/15
to mobile-c...@googlegroups.com
Hi Jens,

Ok, that makes sense. Although in my case, I'm prefixing my queries with the field identifier, which is unique per form, so it would never get mixed up with any results from other forms.

Anyway, makes sense.

Thanks,

Brendan
Reply all
Reply to author
Forward
0 new messages