用例:搜索“MAYUR”结果出现在搜索中,但如果我搜索“MAY”或“MA”,则没有结果。
我已经实现了一个搜索,它在startsWith(“MAY%”)上搜索。
我使用的是couchbase版本4.6.3-4136-E。
错误消息如下:
组织。springframework。数据沙发床。果心CouchbaseQueryExecutionException(CouchbaseQueryExecutionException):
由于以下n1ql错误,无法执行查询:
{“msg”:“找不到索引-原因:queryport.indexNotFound”,“代码”:12016}
{“msg”:“找不到索引-原因:queryport.indexNotFound”,“代码”:12016}
{“msg”:“找不到索引-原因:queryport.indexNotFound”,“代码”:12016}
{“msg”:“找不到索引-原因:queryport.indexNotFound”,“代码”:12016}
Java SDK版本:2.5.5
我时断时续地面临这个问题。
运行查询的代码
public <T> PageImpl<T> runQuery(final Statement statement, final Expression expression, final String alias,
final Pageable pageable, final Class<T> tClazz) {
PageImpl<T> tPage = null;
try {
CompletableFuture<List<T>> entityFuture = CompletableFuture
.supplyAsync(() -> findByN1QLProjection(statement, tClazz)).exceptionally(th -> {
logger.write(new Exception(th.getMessage(), th));
return Collections.emptyList();
});
CompletableFuture<Long> countFuture = CompletableFuture.supplyAsync(() -> doCount(expression, alias))
.exceptionally(th -> {
logger.write(new Exception(th.getMessage(), th));
return 0L;
});
CompletableFuture.allOf(entityFuture, countFuture).get();
tPage = new PageImpl<>(entityFuture.get(), pageable, countFuture.get());
} catch (final InterruptedException | ExecutionException ex) {
logger.write(ex);
tPage = new PageImpl<>(Collections.emptyList(), pageable, 0);
}
return tPage;
}