SHARE
TWEET

Core query for "the blue"

a guest Nov 17th, 2015 74 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_11957$
  6. WITH x92c3c28_title_xq AS (SELECT
  7.    to_tsquery('simple', COALESCE(NULLIF( '(' || btrim(regexp_replace(search_normalize(split_date_range($_11957$the$_11957$)),E'(?:\\s+|:)','&','g'),'&|')  || ')', '()'), ''))&&
  8.    to_tsquery('simple', COALESCE(NULLIF( '(' || btrim(regexp_replace(search_normalize(split_date_range($_11957$blue$_11957$)),E'(?:\\s+|:)','&','g'),'&|')  || ')', '()'), '')) AS tsq,
  9.     to_tsquery('simple', COALESCE(NULLIF( '(' || btrim(regexp_replace(search_normalize(split_date_range($_11957$the$_11957$)),E'(?:\\s+|:)','&','g'),'&|')  || ')', '()'), '')) ||
  10.    to_tsquery('simple', COALESCE(NULLIF( '(' || btrim(regexp_replace(search_normalize(split_date_range($_11957$blue$_11957$)),E'(?:\\s+|:)','&','g'),'&|')  || ')', '()'), '')) AS tsq_rank ),lang_with AS (SELECT id FROM config.coded_value_map WHERE ctype = 'item_lang' AND code = $_11957$eng$_11957$)
  11.  SELECT  m.source AS id,
  12.      ARRAY[m.source] AS records,
  13.      1.0/((AVG(
  14.         (1)
  15.        + (COALESCE(ts_rank_cd('{0.1, 0.2, 0.4, 1.0}', x92c3c28_title.index_vector, x92c3c28_title.tsq_rank, 0) * x92c3c28_title.weight, 0.0))
  16.      )+1 * COALESCE( NULLIF( FIRST(mrv.vlist @> ARRAY[lang_with.id]), FALSE )::INT * 5, 1)))::NUMERIC AS rel,
  17.      1.0/((AVG(
  18.        (1)
  19.        + (COALESCE(ts_rank_cd('{0.1, 0.2, 0.4, 1.0}', x92c3c28_title.index_vector, x92c3c28_title.tsq_rank, 0) * x92c3c28_title.weight, 0.0))
  20.       )+1 * COALESCE( NULLIF( FIRST(mrv.vlist @> ARRAY[lang_with.id]), FALSE )::INT * 5, 1)))::NUMERIC AS rank,
  21.       FIRST(pubdate_t.value) AS tie_break
  22.   FROM  metabib.metarecord_source_map m
  23.  
  24.      LEFT JOIN (
  25.        SELECT fe.*, fe_weight.weight, x92c3c28_title_xq.tsq, x92c3c28_title_xq.tsq_rank /* search */
  26.          FROM  metabib.title_field_entry AS fe
  27.             JOIN config.metabib_field AS fe_weight ON (fe_weight.id = fe.field)
  28.          JOIN x92c3c28_title_xq ON (fe.index_vector @@ x92c3c28_title_xq.tsq)
  29.      ) AS x92c3c28_title ON (m.source = x92c3c28_title.source)
  30.       LEFT JOIN metabib.record_sorter pubdate_t ON m.source = pubdate_t.source AND attr = 'pubdate'
  31.  
  32.       INNER JOIN metabib.record_attr_vector_list mrv ON m.source = mrv.source
  33.  
  34.       ,lang_with
  35.   WHERE 1=1
  36.      AND (
  37.         TRUE
  38.       AND (
  39.          (x92c3c28_title.id IS NOT NULL AND x92c3c28_title.value ~* $_11957$[[:<:]]the\ blue[[:>:]]$_11957$)
  40.         )
  41.      )
  42.   GROUP BY 1
  43.   ORDER BY 4 ASC NULLS LAST, 5 DESC NULLS LAST, 3 DESC
  44.   LIMIT 10000
  45.  $core_query_11957$::TEXT,
  46.                  $${}$$::INT[],
  47.                   $${}$$::INT[],
  48.                   NULL::INT,
  49.                   1000::INT,
  50.                   10000::INT,
  51.                  'f'::BOOL,
  52.                  'f'::BOOL,
  53.                 'f'::BOOL,
  54.                  NULL::INT
  55.             );
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