LEFT JOIN (
SELECT fe.*, fe_weight.weight, x105058a8_title_xq.tsq, x105058a8_title_xq.tsq_rank /* search */
FROM metabib.title_field_entry AS fe
JOIN config.metabib_field AS fe_weight ON (fe_weight.id = fe.field)
JOIN x105058a8_title_xq ON (fe.index_vector @@ x105058a8_title_xq.tsq)
) AS x105058a8_title ON (m.source = x105058a8_title.source)
INNER JOIN metabib.record_attr mrd ON m.source = mrd.id
WHERE 1=1
AND (
TRUE
AND (x105058a8_title.id IS NOT NULL)
)
GROUP BY 1
Here's the core query that QP is passing to search. query_parser_ fts() for a title search for "mens health"
WITH x105058a8_title_xq AS (SELECT tsquery( 'simple' , COALESCE(NULLIF( '(' || btrim(regexp_ replace( search_ normalize( split_date_ range($ _9405$mens$ _9405$) ),E'(?: \\s+|:) ','&',' g'),'&| ') || ')', '()'), ''))&& tsquery( 'simple' , COALESCE(NULLIF( '(' || btrim(regexp_ replace( search_ normalize( split_date_ range($ _9405$health$ _9405$) ),E'(?: \\s+|:) ','&',' g'),'&| ') || ')', '()'), '')) AS tsq, tsquery( 'simple' , COALESCE(NULLIF( '(' || btrim(regexp_ replace( search_ normalize( split_date_ range($ _9405$mens$ _9405$) ),E'(?: \\s+|:) ','&',' g'),'&| ') || ')', '()'), '')) || tsquery( 'simple' , COALESCE(NULLIF( '(' || btrim(regexp_ replace( search_ normalize( split_date_ range($ _9405$health$ _9405$) ),E'(?: \\s+|:) ','&',' g'),'&| ') || ')', '()'), '')) AS tsq_rank )
ARRAY[ m.source] AS records, ts_rank_ cd('{0. 1, 0.2, 0.4, 1}', x105058a8_ title.index_ vector, x105058a8_ title.tsq_ rank, 14) * x105058a8_ title.weight, 0.0)) eng$_9405$ )), FALSE )::INT * 5, 1)))::NUMERIC AS rel, ts_rank_ cd('{0. 1, 0.2, 0.4, 1}', x105058a8_ title.index_ vector, x105058a8_ title.tsq_ rank, 14) * x105058a8_ title.weight, 0.0)) eng$_9405$ )), FALSE )::INT * 5, 1)))::NUMERIC AS rank,
FIRST( mrd.attrs- >'date1' ) AS tie_break metarecord_ source_ map m
to_
to_
to_
to_
SELECT m.source AS id,
1.0/((AVG(
(1)
+ (COALESCE(
)+1 * COALESCE( NULLIF( FIRST(mrd.attrs @> hstore('item_lang', $_9405$
1.0/((AVG(
(1)
+ (COALESCE(
)+1 * COALESCE( NULLIF( FIRST(mrd.attrs @> hstore('item_lang', $_9405$
FROM metabib.
LEFT JOIN ( title_xq. tsq, x105058a8_ title_xq. tsq_rank /* search */ title_field_ entry AS fe metabib_ field AS fe_weight ON (fe_weight.id = fe.field) title_xq. tsq) title.source)
SELECT fe.*, fe_weight.weight, x105058a8_
FROM metabib.
JOIN config.
JOIN x105058a8_title_xq ON (fe.index_vector @@ x105058a8_
) AS x105058a8_title ON (m.source = x105058a8_
INNER JOIN metabib.record_attr mrd ON m.source = mrd.id
WHERE 1=1
AND (
TRUE
AND (x105058a8_title.id IS NOT NULL)
)
GROUP BY 1