mirror of https://codeberg.org/cage/tinmop/
- added clause 'into' in local fediverse query.
This commit is contained in:
parent
824e89883a
commit
720c55e5b3
|
@ -130,10 +130,22 @@
|
|||
(strcat "where " (join-with-strings (third a) " "))
|
||||
""))))
|
||||
|
||||
(defrule fedisearch-into (and "into" fedisearch-spaces (+ (not fedisearch-blank)))
|
||||
(:function (lambda (a)
|
||||
(third a)))
|
||||
(:text t))
|
||||
|
||||
(defrule fedisearch-query (? (and fedisearch-where-clause (? (and fedisearch-spaces fedisearch-into))))
|
||||
(:function (lambda (a)
|
||||
(list (first a) (second (second a))))))
|
||||
|
||||
(defun parse-search-statuses (query)
|
||||
(let* ((where-clause (parse 'fedisearch-where-clause query))
|
||||
(sql-query (strcat (format nil
|
||||
"select * from \"~a\" ~a"
|
||||
+view-search-fediverse-statuses+
|
||||
where-clause))))
|
||||
(db-utils:query-low-level sql-query)))
|
||||
(let* ((parsed (parse 'fedisearch-query query))
|
||||
(where-clause (first parsed))
|
||||
(destination-folder (second parsed))
|
||||
(sql-query (strcat (format nil
|
||||
"select * from \"~a\" ~@[~a~]"
|
||||
+view-search-fediverse-statuses+
|
||||
where-clause))))
|
||||
(values (db-utils:query-low-level sql-query)
|
||||
destination-folder)))
|
||||
|
|
|
@ -2038,26 +2038,30 @@
|
|||
|
||||
(defmethod process-event ((object fediverse-local-query-event))
|
||||
(with-accessors ((payload payload)) object
|
||||
(loop for status-results in (fediverse-post-local-search:parse-search-statuses payload) do
|
||||
(let* ((status-id (db:row-message-status-id status-results))
|
||||
(status-row (db:find-status-id status-id)))
|
||||
(when (not (db::find-status-id-folder-timeline status-id
|
||||
(query-results-folder-name)
|
||||
db:+home-timeline+))
|
||||
(setf (getf status-row :folder)
|
||||
(query-results-folder-name))
|
||||
(setf (getf status-row :timeline)
|
||||
db:+home-timeline+)
|
||||
(multiple-value-bind (query column-values)
|
||||
(db-utils:insert-query db:+table-status+ status-row)
|
||||
(db-utils:query-low-level query column-values)))))
|
||||
(db:renumber-timeline-message-index db:+home-timeline+
|
||||
(query-results-folder-name)
|
||||
:account-id nil)
|
||||
(let ((refresh-event (make-instance 'refresh-thread-windows-event
|
||||
:new-folder (query-results-folder-name)
|
||||
:new-timeline db:+home-timeline+)))
|
||||
(push-event refresh-event))))
|
||||
(multiple-value-bind (statuses destination-folder)
|
||||
(fediverse-post-local-search:parse-search-statuses payload)
|
||||
(let ((folder (or destination-folder
|
||||
(query-results-folder-name))))
|
||||
(loop for status in statuses do
|
||||
(let* ((status-id (db:row-message-status-id status))
|
||||
(status-row (db:find-status-id status-id)))
|
||||
(when (not (db::find-status-id-folder-timeline status-id
|
||||
folder
|
||||
db:+home-timeline+))
|
||||
(setf (getf status-row :folder)
|
||||
folder)
|
||||
(setf (getf status-row :timeline)
|
||||
db:+home-timeline+)
|
||||
(multiple-value-bind (query column-values)
|
||||
(db-utils:insert-query db:+table-status+ status-row)
|
||||
(db-utils:query-low-level query column-values)))))
|
||||
(db:renumber-timeline-message-index db:+home-timeline+
|
||||
folder
|
||||
:account-id nil)
|
||||
(let ((refresh-event (make-instance 'refresh-thread-windows-event
|
||||
:new-folder folder
|
||||
:new-timeline db:+home-timeline+)))
|
||||
(push-event refresh-event))))))
|
||||
|
||||
;;;; end events
|
||||
|
||||
|
|
Loading…
Reference in New Issue