|
@@ -976,6 +976,7 @@ func FullTextSearchBlock(query string, boxes, paths []string, types map[string]b
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ query = filterQueryInvisibleChars(query)
|
|
|
trimQuery := strings.TrimSpace(query)
|
|
|
if "" != trimQuery {
|
|
|
query = trimQuery
|
|
@@ -1223,7 +1224,6 @@ func buildTypeFilter(types map[string]bool) string {
|
|
|
}
|
|
|
|
|
|
func searchBySQL(stmt string, beforeLen, page, pageSize int) (ret []*Block, matchedBlockCount, matchedRootCount int) {
|
|
|
- stmt = filterQueryInvisibleChars(stmt)
|
|
|
stmt = strings.TrimSpace(stmt)
|
|
|
blocks := sql.SelectBlocksRawStmt(stmt, page, pageSize)
|
|
|
ret = fromSQLBlocks(&blocks, "", beforeLen)
|
|
@@ -1348,7 +1348,6 @@ func extractID(content string) (ret string) {
|
|
|
}
|
|
|
|
|
|
func fullTextSearchByQuerySyntax(query, boxFilter, pathFilter, typeFilter, ignoreFilter, orderBy string, beforeLen, page, pageSize int) (ret []*Block, matchedBlockCount, matchedRootCount int) {
|
|
|
- query = filterQueryInvisibleChars(query)
|
|
|
if ast.IsNodeIDPattern(query) {
|
|
|
ret, matchedBlockCount, matchedRootCount = searchBySQL("SELECT * FROM `blocks` WHERE `id` = '"+query+"'", beforeLen, page, pageSize)
|
|
|
return
|
|
@@ -1357,7 +1356,6 @@ func fullTextSearchByQuerySyntax(query, boxFilter, pathFilter, typeFilter, ignor
|
|
|
}
|
|
|
|
|
|
func fullTextSearchByKeyword(query, boxFilter, pathFilter, typeFilter, ignoreFilter string, orderBy string, beforeLen, page, pageSize int) (ret []*Block, matchedBlockCount, matchedRootCount int) {
|
|
|
- query = filterQueryInvisibleChars(query)
|
|
|
if ast.IsNodeIDPattern(query) {
|
|
|
ret, matchedBlockCount, matchedRootCount = searchBySQL("SELECT * FROM `blocks` WHERE `id` = '"+query+"'", beforeLen, page, pageSize)
|
|
|
return
|
|
@@ -1366,8 +1364,6 @@ func fullTextSearchByKeyword(query, boxFilter, pathFilter, typeFilter, ignoreFil
|
|
|
}
|
|
|
|
|
|
func fullTextSearchByRegexp(exp, boxFilter, pathFilter, typeFilter, ignoreFilter, orderBy string, beforeLen, page, pageSize int) (ret []*Block, matchedBlockCount, matchedRootCount int) {
|
|
|
- exp = filterQueryInvisibleChars(exp)
|
|
|
-
|
|
|
fieldFilter := fieldRegexp(exp)
|
|
|
stmt := "SELECT * FROM `blocks` WHERE " + fieldFilter + " AND type IN " + typeFilter
|
|
|
stmt += boxFilter + pathFilter + ignoreFilter + " " + orderBy
|