|
|
@@ -1139,7 +1139,14 @@ func (db *datastore) GetPostsTagged(c *Collection, tag string, page int, include |
|
|
|
if !includeFuture { |
|
|
|
timeCondition = "AND created <= " + db.now() |
|
|
|
} |
|
|
|
rows, err := db.Query("SELECT "+postCols+" FROM posts WHERE collection_id = ? AND LOWER(content) RLIKE ? "+timeCondition+" ORDER BY created "+order+limitStr, collID, "#"+strings.ToLower(tag)+"[[:>:]]") |
|
|
|
|
|
|
|
var rows *sql.Rows |
|
|
|
var err error |
|
|
|
if db.driverName == driverSQLite { |
|
|
|
rows, err = db.Query("SELECT "+postCols+" FROM posts WHERE collection_id = ? AND LOWER(content) regexp ? "+timeCondition+" ORDER BY created "+order+limitStr, collID, `.*#`+strings.ToLower(tag)+`\b.*`) |
|
|
|
} else { |
|
|
|
rows, err = db.Query("SELECT "+postCols+" FROM posts WHERE collection_id = ? AND LOWER(content) RLIKE ? "+timeCondition+" ORDER BY created "+order+limitStr, collID, "#"+strings.ToLower(tag)+"[[:>:]]") |
|
|
|
} |
|
|
|
if err != nil { |
|
|
|
log.Error("Failed selecting from posts: %v", err) |
|
|
|
return nil, impart.HTTPError{http.StatusInternalServerError, "Couldn't retrieve collection posts."} |
|
|
|