How to use Rank function

Hello, i want to get ranking for FTS search and order results but can’t find how to do that in documentation. There is just a few sentences without any examples I am using java sdk and i want to get this value in both select and order statements. Is it possible? Another question is where i can find library sources( classes, functions ) for couchbase lite java sdk, can’t find all together in github repository

It looks like i found answer. Here is example how to use it:

Expression ftsExp = FullTextExpression.index("myFTSIndex").match(value) ;
        Query searchQuery = QueryBuilder
                .select(SelectResult.all(), SelectResult.expression(FullTextFunction.rank("myFTSIndex")).as("rank"))

documentation is so poor :slightly_frowning_face:

Hey @Sergey_Zhukov: That feature is documented here:

We’ve been working on our docs a lot recently. I’m putting in a request for an example in discussion of you to use a ranking function.

The blog post gives you examples on ranking. Example is in swift but easily mappable to other languages.

In general our blogs are a good place to look for examples, tutorials and how-to guides outside of our docs. In future, we’ll will be adding relevant reference links in our docs.