FTS4 匹配信息不适用于 android 房间数据库
FTS4 matchinfo not working with android room database
我在 FTS 虚拟 table 中有两列(name
和 description
),我想使用 [=16= 优先考虑 FTS 中的 name
列] 函数,但在 android 中有空间,我收到以下错误:
Error retrieving data from table.: unable to use function matchinfo in the requested context (code 1 SQLITE_ERROR)
这是我的查询:
@Query("""select workout_cache.id, workout_cache.met, workout_cache.name, workout_cache.workoutDescription, matchinfo(workout_cache_fts, 'pcs') as mi
from workout_cache join workout_cache_fts on workout_cache.id = workout_cache_fts.id
where workout_cache_fts match :text group by workout_cache.id""")
abstract suspend fun query(text: String): List<WorkoutCacheEntityWithMatchInfo>
我的WorkoutCacheEntityWithMatchInfo
class
class WorkoutCacheEntityWithMatchInfo(
@Embedded
val workout: WorkoutCacheEntity,
@ColumnInfo(name = "mi")
val matchInfo: ByteArray
)
UPDATE: It's working fine when I don't use join clause.
这很愚蠢。我刚刚删除了 group by
子句并且它起作用了。
此处更新道:
@Query("""select workout_cache.id, workout_cache.met, workout_cache.name, workout_cache.workoutDescription, matchinfo(workout_cache_fts, 'pcs') as mi
from workout_cache join workout_cache_fts on workout_cache.id = workout_cache_fts.id
where workout_cache_fts match :text""")
abstract suspend fun query(text: String): List<WorkoutCacheEntityWithMatchInfo>
我在 FTS 虚拟 table 中有两列(name
和 description
),我想使用 [=16= 优先考虑 FTS 中的 name
列] 函数,但在 android 中有空间,我收到以下错误:
Error retrieving data from table.: unable to use function matchinfo in the requested context (code 1 SQLITE_ERROR)
这是我的查询:
@Query("""select workout_cache.id, workout_cache.met, workout_cache.name, workout_cache.workoutDescription, matchinfo(workout_cache_fts, 'pcs') as mi
from workout_cache join workout_cache_fts on workout_cache.id = workout_cache_fts.id
where workout_cache_fts match :text group by workout_cache.id""")
abstract suspend fun query(text: String): List<WorkoutCacheEntityWithMatchInfo>
我的WorkoutCacheEntityWithMatchInfo
class
class WorkoutCacheEntityWithMatchInfo(
@Embedded
val workout: WorkoutCacheEntity,
@ColumnInfo(name = "mi")
val matchInfo: ByteArray
)
UPDATE: It's working fine when I don't use join clause.
这很愚蠢。我刚刚删除了 group by
子句并且它起作用了。
此处更新道:
@Query("""select workout_cache.id, workout_cache.met, workout_cache.name, workout_cache.workoutDescription, matchinfo(workout_cache_fts, 'pcs') as mi
from workout_cache join workout_cache_fts on workout_cache.id = workout_cache_fts.id
where workout_cache_fts match :text""")
abstract suspend fun query(text: String): List<WorkoutCacheEntityWithMatchInfo>