count All User Collections

@Query(value = "SELECT ( " + " ( " + " SELECT COUNT(*) " + " FROM " + COLLECTIONS_KEY + " AS c" + _WHERE_ + "c." + OWNER_KEY + "=:" + USER_IDENTIFIER_KEY + " AND ( " + " MATCH(c." + TITLE_KEY + ", c." + DESCRIPTION_KEY + ") AGAINST (:" + KEYWORDS_KEY + _IN_BOOLEAN_MODE + ") " + " OR :" + KEYWORDS_KEY + " =''" + " ) " + " ) + " + " ( " + " SELECT COUNT(*) " + " FROM " + COLLECTIONS_KEY + " AS c " + " INNER JOIN " + COLLECTIONS_TEAMS_TABLE + " ON c." + IDENTIFIER_KEY + " = " + COLLECTIONS_TEAMS_TABLE + "." + COLLECTION_IDENTIFIER_KEY + " INNER JOIN " + MEMBERS_KEY + " ON " + MEMBERS_KEY + "." + TEAM_IDENTIFIER_KEY + "=" + COLLECTIONS_TEAMS_TABLE + "." + TEAM_IDENTIFIER_KEY + _WHERE_ + MEMBERS_KEY + "." + OWNER_KEY + "=:" + USER_IDENTIFIER_KEY + " AND ( " + " MATCH(c." + TITLE_KEY + ", c." + DESCRIPTION_KEY + ") AGAINST (:" + KEYWORDS_KEY + _IN_BOOLEAN_MODE + ") " + " OR :" + KEYWORDS_KEY + "=''" + " ) " + " ) " + ")", nativeQuery = true )
abstract fun countAllUserCollections(@Param(value = "user_id") userId: String, @Param(value = "keywords") keywords: String): Long

Method to count all the user's collections, included the collections shared in the teams

Return

the user collections as long

Parameters

userId

The identifier of the user

keywords

The keywords used to filter the query to retrieve the items