Ordering full text search results

17 views
Skip to first unread message

Andy Appleton

unread,
May 20, 2014, 4:21:30 AM5/20/14
to mobile-c...@googlegroups.com
I'm using full text search with CBL in an iOS app and was wondering if there's any way to order the results by the value of another field on the document (in this case a timestamp)?

Jens Alfke

unread,
May 22, 2014, 12:38:08 PM5/22/14
to mobile-c...@googlegroups.com

On May 20, 2014, at 1:21 AM, Andy Appleton <andys...@gmail.com> wrote:

I'm using full text search with CBL in an iOS app and was wondering if there's any way to order the results by the value of another field on the document (in this case a timestamp)?

No, that’s part of a general limitation that you can’t sort by a different criterion than the key that’s used for range (or keyword) matching. I’d like to improve this in the future, whether that’s through adopting Couchbase’s NiQL query language or a procedural API like CoreData’s.

For now you’ll have to query on one key (i.e. the full text keyword) and then postprocess the results to sort them in the order you want.

—Jens
Reply all
Reply to author
Forward
0 new messages