Difference between revisions of "Template:SearchResults"

From Culture.si
(restored by csi_restorechanges)
 
Line 25: Line 25:
 
     | {{#fetch:sql
 
     | {{#fetch:sql
 
       | SELECT count(page_id) as count
 
       | SELECT count(page_id) as count
         FROM page p, revision r, pagecontent c
+
         FROM page p
         WHERE p.page_latest = r.rev_id
+
         LEFT JOIN content ct
         AND r.rev_text_id = c.old_id
+
          ON p.page_latest = ct.content_id
         AND (
+
         LEFT JOIN pagecontent c
          textvector @@ userto_tsquery( {{#cast:text|{{{query|}}}|db}})
+
          ON CONCAT('tt:', c.old_id) = ct.content_address
 +
         WHERE textvector @@ userto_tsquery( {{#cast:text|{{{query|}}}|db}})
 
           OR titlevector @@ userto_tsquery( {{#cast:text|{{{query|}}}|db}})
 
           OR titlevector @@ userto_tsquery( {{#cast:text|{{{query|}}}|db}})
        )
 
 
         -- AND page_is_redirect = '0'
 
         -- AND page_is_redirect = '0'
 
         AND page_namespace IN ({{{ns}}})  
 
         AND page_namespace IN ({{{ns}}})  
Line 47: Line 47:
 
{{#array:dataloop
 
{{#array:dataloop
  
|{{#fetch:sql|SELECT *, ts_headline(page_text, userto_tsquery( {{#cast:text|{{{query|}}}|db}})) as snippet FROM (SELECT page_id, page_namespace, page_title as title, old_text AS page_text, 3*ts_rank(titlevector, userto_tsquery( {{#cast:text|{{{query|}}}|db}})) + ts_rank(textvector, userto_tsquery( {{#cast:text|{{{query|}}}|db}})) AS rnk FROM page p, revision r,
+
|{{#fetch:sql|SELECT *, ts_headline(page_text, userto_tsquery( {{#cast:text|{{{query|}}}|db}})) as snippet FROM (SELECT page_id, page_namespace, page_title as title, old_text AS page_text, 3*ts_rank(titlevector, userto_tsquery( {{#cast:text|{{{query|}}}|db}})) + ts_rank(textvector, userto_tsquery( {{#cast:text|{{{query|}}}|db}})) AS rnk
pagecontent c WHERE p.page_latest = r.rev_id AND r.rev_text_id = c.old_id AND (textvector @@ userto_tsquery( {{#cast:text|{{{query|}}}|db}}) OR titlevector @@ userto_tsquery( {{#cast:text|{{{query|}}}|db}})) AND page_is_redirect = '0' AND page_namespace IN  
+
  FROM page p
 +
  LEFT JOIN content ct
 +
    ON p.page_latest = ct.content_id
 +
  LEFT JOIN pagecontent c
 +
    ON CONCAT('tt:', c.old_id) = ct.content_address
 +
  WHERE (textvector @@ userto_tsquery( {{#cast:text|{{{query|}}}|db}}) OR titlevector @@ userto_tsquery( {{#cast:text|{{{query|}}}|db}})) AND page_is_redirect = '0' AND page_namespace IN  
 
({{{ns}}}) ORDER BY rnk DESC, page_namespace ASC,page_id desc LIMIT {{{next}}} OFFSET {{{offset}}}) as tab }}
 
({{{ns}}}) ORDER BY rnk DESC, page_namespace ASC,page_id desc LIMIT {{{next}}} OFFSET {{{offset}}}) as tab }}
 
|each = {{#ifeq:{{{:#:}}}|{{{limit}}}||
 
|each = {{#ifeq:{{{:#:}}}|{{{limit}}}||

Latest revision as of 01:14, 11 February 2021


 
Enter your search string and click Search