[polari/wip/carlosg/tracker: 10/15] logger: Build channel URN for query



commit 1a7d38ebfef7206e059b9a49327439dab29fca01
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Feb 24 23:03:33 2019 +0100

    logger: Build channel URN for query
    
    Channels have a guessable name, and it speeds up the query
    considerably.

 src/logger.js | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/src/logger.js b/src/logger.js
index 448cb89..0ca64e5 100644
--- a/src/logger.js
+++ b/src/logger.js
@@ -146,6 +146,7 @@ var LogWalker = class {
         if (!this._query) {
             this._query = new GenericQuery(numEvents);
 
+            let channel = 
Tracker.sparql_escape_uri(`urn:channel:${this._room.account.get_path_suffix()}:${this._room.channel_name}`);
             let sparql = `
                 select polari:text(?msg) as ?text
                        polari:nick(?sender) as ?sender
@@ -154,10 +155,7 @@ var LogWalker = class {
                        (exists { ?sender a polari:SelfContact }) as ?isSelf
                 { ?msg a polari:Message;
                        polari:sender ?sender;
-                       polari:channel ?chan .
-                  ?chan polari:account ?account;
-                        polari:name "${this._room.channel_name}" .
-                  ?account polari:id "${this._room.account.get_path_suffix()}"
+                       polari:channel <${channel}>
                 } order by desc(?time) desc(tracker:id(?msg))
             `;
             this._query.run(sparql, null, returnFunc);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]