SHARE
TWEET

Core query for the blue

a guest Nov 17th, 2015 97 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT  * -- bib search: #CD_documentLength #CD_meanHarmonic #CD_uniqueWords core_limit(10000) limit(1000) estimation_strategy(inclusion)  keyword: title:the blue depth(0)
  2.        FROM  search.query_parser_fts(
  3.                 1::INT,
  4.                 0::INT,
  5.                  $core_query_4790$
  6. WITH x9dfa5e8_title_xq AS (SELECT
  7.    to_tsquery('simple', COALESCE(NULLIF( '(' || btrim(regexp_replace(search_normalize(split_date_range($_4790$the$_4790$)),E'(?:\\s+|:)','&','g'),'&|')  || ')', '()'), ''))&&
  8.    to_tsquery('simple', COALESCE(NULLIF( '(' || btrim(regexp_replace(search_normalize(split_date_range($_4790$blue$_4790$)),E'(?:\\s+|:)','&','g'),'&|')  || ')', '()'), '')) AS tsq,
  9.    to_tsquery('simple', COALESCE(NULLIF( '(' || btrim(regexp_replace(search_normalize(split_date_range($_4790$the$_4790$)),E'(?:\\s+|:)','&','g'),'&|')  || ')', '()'), '')) ||
  10.    to_tsquery('simple', COALESCE(NULLIF( '(' || btrim(regexp_replace(search_normalize(split_date_range($_4790$blue$_4790$)),E'(?:\\s+|:)','&','g'),'&|')  || ')', '()'), '')) AS tsq_rank ),lang_with AS (SELECT id FROM config.coded_value_map WHERE ctype = 'item_lang' AND code = $_4790$eng$_4790$)
  11. SELECT  m.source AS id,
  12.      ARRAY[m.source] AS records,
  13.      1.0/((AVG(
  14.        (COALESCE(ts_rank_cd('{0.1, 0.2, 0.4, 1.0}', x9dfa5e8_title.index_vector, x9dfa5e8_title.tsq_rank, 14) * x9dfa5e8_title.weight, 0.0))
  15.      )+1 * COALESCE( NULLIF( FIRST(mrv.vlist @> ARRAY[lang_with.id]), FALSE )::INT * 5, 1)))::NUMERIC AS rel,
  16.      1.0/((AVG(
  17.        (COALESCE(ts_rank_cd('{0.1, 0.2, 0.4, 1.0}', x9dfa5e8_title.index_vector, x9dfa5e8_title.tsq_rank, 14) * x9dfa5e8_title.weight, 0.0))
  18.      )+1 * COALESCE( NULLIF( FIRST(mrv.vlist @> ARRAY[lang_with.id]), FALSE )::INT * 5, 1)))::NUMERIC AS rank,
  19.      FIRST(pubdate_t.value) AS tie_break
  20.   FROM  metabib.metarecord_source_map m
  21.  
  22.      LEFT JOIN (
  23.        SELECT fe.*, fe_weight.weight, x9dfa5e8_title_xq.tsq, x9dfa5e8_title_xq.tsq_rank /* search */
  24.          FROM  metabib.title_field_entry AS fe
  25.            JOIN config.metabib_field AS fe_weight ON (fe_weight.id = fe.field)
  26.          JOIN x9dfa5e8_title_xq ON (fe.index_vector @@ x9dfa5e8_title_xq.tsq)
  27.      ) AS x9dfa5e8_title ON (m.source = x9dfa5e8_title.source)
  28.      LEFT JOIN metabib.record_sorter pubdate_t ON m.source = pubdate_t.source AND attr = 'pubdate'
  29.  
  30.      INNER JOIN metabib.record_attr_vector_list mrv ON m.source = mrv.source
  31.  
  32.      ,lang_with
  33.   WHERE 1=1
  34.      AND (
  35.        (x9dfa5e8_title.id IS NOT NULL)
  36.      )
  37.   GROUP BY 1
  38.   ORDER BY 4 ASC NULLS LAST, 5 DESC NULLS LAST, 3 DESC
  39.   LIMIT 10000
  40. $core_query_4790$::TEXT,
  41.                  $${}$$::INT[],
  42.                  $${}$$::INT[],
  43.                  NULL::INT,
  44.                  1000::INT,
  45.                  10000::INT,
  46.                  'f'::BOOL,
  47.                  'f'::BOOL,
  48.                  'f'::BOOL,
  49.                  NULL::INT
  50.              );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top