最多匹配件数检查修改

This commit is contained in:
gotoeasy 2023-08-23 09:32:27 +08:00
parent 05cd92ab4e
commit 286be910e1

View File

@ -2,6 +2,7 @@ package ldb
import (
"glc/com"
"glc/conf"
"glc/ldb/search"
"glc/ldb/storage"
"glc/ldb/storage/indexword"
@ -74,13 +75,24 @@ func (e *Engine) Search(searchKey string, system string, minDatetime string, max
}
}
var rs *search.SearchResult
if len(kws) == 0 {
// 无条件浏览模式
return search.SearchLogData(e.storeName, currentDocId, forward, minDatetime, maxDatetime)
rs = search.SearchLogData(e.storeName, currentDocId, forward, minDatetime, maxDatetime)
} else {
// 多关键词查询模式
rs = search.SearchWordIndex(e.storeName, kws, currentDocId, forward, minDatetime, maxDatetime)
}
// 多关键词查询模式
return search.SearchWordIndex(e.storeName, kws, currentDocId, forward, minDatetime, maxDatetime)
if !forward {
// 修复最多匹配件数检索非检索更多数据量少于1页时最多匹配件数=检索结果件数,避免个别特殊场景下两者不一致
size := len(rs.Data)
if size < conf.GetPageSize() {
rs.Count = cmn.IntToString(size)
}
}
return rs
}
// 添加日志