Fossil SCM

Do not filter out the chat-robot messages from /chat search, per feedback.

stephan 2024-07-01 15:49 fts5-chat-search
Commit b5281f4e6127551e52abd5b7b5867ad1cbc0e0b775b18d4ee3aa018f1326d21e
1 file changed +2 -12
+2 -12
--- src/chat.c
+++ src/chat.c
@@ -753,30 +753,20 @@
753753
}
754754
chat_create_tables();
755755
cgi_set_content_type("application/json");
756756
757757
if( zQuery[0] ){
758
- char *zChatRobot = db_get("chat-timeline-user", 0);
759758
iMax = db_int64(0, "SELECT max(msgid) FROM chat");
760759
iMin = db_int64(0, "SELECT min(msgid) FROM chat");
761760
blob_append_sql(&sql,
762761
"SELECT * FROM ("
763762
"SELECT c.msgid, datetime(c.mtime), c.xfrom, "
764763
" highlight(chatfts1, 0, '<span class=\"match\">', '</span>'), "
765764
" octet_length(c.file), c.fname, c.fmime, c.mdel, c.lmtime"
766
- " FROM chatfts1(%Q) f, chat c WHERE f.rowid=c.msgid ",
767
- zQuery
768
- );
769
- if( zChatRobot!=0 ){
770
- if( zChatRobot[0]!=0 ){
771
- blob_append_sql(&sql, "AND c.xfrom IS NOT %Q ", zChatRobot);
772
- }
773
- fossil_free( zChatRobot );
774
- }
775
- blob_append_sql(&sql,
765
+ " FROM chatfts1(%Q) f, chat c WHERE f.rowid=c.msgid "
776766
" ORDER BY f.rowid DESC LIMIT %d"
777
- ") ORDER BY 1 ASC", nLimit
767
+ ") ORDER BY 1 ASC", zQuery, nLimit
778768
);
779769
}else{
780770
blob_append_sql(&sql,
781771
"SELECT msgid, datetime(mtime), xfrom, "
782772
" xmsg, octet_length(file), fname, fmime, mdel, lmtime"
783773
--- src/chat.c
+++ src/chat.c
@@ -753,30 +753,20 @@
753 }
754 chat_create_tables();
755 cgi_set_content_type("application/json");
756
757 if( zQuery[0] ){
758 char *zChatRobot = db_get("chat-timeline-user", 0);
759 iMax = db_int64(0, "SELECT max(msgid) FROM chat");
760 iMin = db_int64(0, "SELECT min(msgid) FROM chat");
761 blob_append_sql(&sql,
762 "SELECT * FROM ("
763 "SELECT c.msgid, datetime(c.mtime), c.xfrom, "
764 " highlight(chatfts1, 0, '<span class=\"match\">', '</span>'), "
765 " octet_length(c.file), c.fname, c.fmime, c.mdel, c.lmtime"
766 " FROM chatfts1(%Q) f, chat c WHERE f.rowid=c.msgid ",
767 zQuery
768 );
769 if( zChatRobot!=0 ){
770 if( zChatRobot[0]!=0 ){
771 blob_append_sql(&sql, "AND c.xfrom IS NOT %Q ", zChatRobot);
772 }
773 fossil_free( zChatRobot );
774 }
775 blob_append_sql(&sql,
776 " ORDER BY f.rowid DESC LIMIT %d"
777 ") ORDER BY 1 ASC", nLimit
778 );
779 }else{
780 blob_append_sql(&sql,
781 "SELECT msgid, datetime(mtime), xfrom, "
782 " xmsg, octet_length(file), fname, fmime, mdel, lmtime"
783
--- src/chat.c
+++ src/chat.c
@@ -753,30 +753,20 @@
753 }
754 chat_create_tables();
755 cgi_set_content_type("application/json");
756
757 if( zQuery[0] ){
 
758 iMax = db_int64(0, "SELECT max(msgid) FROM chat");
759 iMin = db_int64(0, "SELECT min(msgid) FROM chat");
760 blob_append_sql(&sql,
761 "SELECT * FROM ("
762 "SELECT c.msgid, datetime(c.mtime), c.xfrom, "
763 " highlight(chatfts1, 0, '<span class=\"match\">', '</span>'), "
764 " octet_length(c.file), c.fname, c.fmime, c.mdel, c.lmtime"
765 " FROM chatfts1(%Q) f, chat c WHERE f.rowid=c.msgid "
 
 
 
 
 
 
 
 
 
766 " ORDER BY f.rowid DESC LIMIT %d"
767 ") ORDER BY 1 ASC", zQuery, nLimit
768 );
769 }else{
770 blob_append_sql(&sql,
771 "SELECT msgid, datetime(mtime), xfrom, "
772 " xmsg, octet_length(file), fname, fmime, mdel, lmtime"
773

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button