Fossil

Check-in [b5281f4e61]
Login

Check-in [b5281f4e61]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Do not filter out the chat-robot messages from /chat search, per feedback.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | fts5-chat-search
Files: files | file ages | folders
SHA3-256: b5281f4e6127551e52abd5b7b5867ad1cbc0e0b775b18d4ee3aa018f1326d21e
User & Date: stephan 2024-07-01 15:49:35.859
Context
2024-07-01
17:25
Teach /chat search to use the same tokenizer as the main search index, defaulting to porter if the main search index is off, and reindex chat if the tokenizer is changed. The search config should arguably be expanded to provide the option of disabling chat search altogether, but that is beyond today's ambitions. Minor search result layout tweaks but there are still some fixes to do there. ... (check-in: 778efb30f7 user: stephan tags: fts5-chat-search)
15:49
Do not filter out the chat-robot messages from /chat search, per feedback. ... (check-in: b5281f4e61 user: stephan tags: fts5-chat-search)
15:22
Use temporary triggers, instead of normal schema triggers, to populate the fts index. Fossil disables schema triggers to prevent malicious uses. ... (check-in: 21d9ea4ade user: dan tags: fts5-chat-search)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/chat.c.
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
    chat_emit_permissions_error(1);
    return;
  }
  chat_create_tables();
  cgi_set_content_type("application/json");

  if( zQuery[0] ){
    char *zChatRobot = db_get("chat-timeline-user", 0);
    iMax = db_int64(0, "SELECT max(msgid) FROM chat");
    iMin = db_int64(0, "SELECT min(msgid) FROM chat");
    blob_append_sql(&sql,
        "SELECT * FROM ("
        "SELECT c.msgid, datetime(c.mtime), c.xfrom, "
        "  highlight(chatfts1, 0, '<span class=\"match\">', '</span>'), "
        "  octet_length(c.file), c.fname, c.fmime, c.mdel, c.lmtime"
        "  FROM chatfts1(%Q) f, chat c WHERE f.rowid=c.msgid ",
        zQuery
    );
    if( zChatRobot!=0 ){
      if( zChatRobot[0]!=0 ){
        blob_append_sql(&sql, "AND c.xfrom IS NOT %Q ", zChatRobot);
      }
      fossil_free( zChatRobot );
    }
    blob_append_sql(&sql,
        "  ORDER BY f.rowid DESC LIMIT %d"
        ") ORDER BY 1 ASC", nLimit
    );
  }else{
    blob_append_sql(&sql,
        "SELECT msgid, datetime(mtime), xfrom, "
        "  xmsg, octet_length(file), fname, fmime, mdel, lmtime"
        "  FROM chat WHERE msgid>=%d LIMIT %d",
        iFirst, nLimit







<







|
<
<
<
<
<
<
<
<
<

|







751
752
753
754
755
756
757

758
759
760
761
762
763
764
765









766
767
768
769
770
771
772
773
774
    chat_emit_permissions_error(1);
    return;
  }
  chat_create_tables();
  cgi_set_content_type("application/json");

  if( zQuery[0] ){

    iMax = db_int64(0, "SELECT max(msgid) FROM chat");
    iMin = db_int64(0, "SELECT min(msgid) FROM chat");
    blob_append_sql(&sql,
        "SELECT * FROM ("
        "SELECT c.msgid, datetime(c.mtime), c.xfrom, "
        "  highlight(chatfts1, 0, '<span class=\"match\">', '</span>'), "
        "  octet_length(c.file), c.fname, c.fmime, c.mdel, c.lmtime"
        "  FROM chatfts1(%Q) f, chat c WHERE f.rowid=c.msgid "









        "  ORDER BY f.rowid DESC LIMIT %d"
        ") ORDER BY 1 ASC", zQuery, nLimit
    );
  }else{
    blob_append_sql(&sql,
        "SELECT msgid, datetime(mtime), xfrom, "
        "  xmsg, octet_length(file), fname, fmime, mdel, lmtime"
        "  FROM chat WHERE msgid>=%d LIMIT %d",
        iFirst, nLimit