Text:
, StopSel = ') AS highlight_author, ts_headline('jiebacfg', title, websearch_to_tsquery('jiebacfg', '$q'), 'StartSel = , StopSel = ') AS highlight_title, ts_headline('jiebacfg', subtitle, websearch_to_tsquery('jiebacfg', '$q'), 'StartSel = , StopSel = ') AS highlight_subtitle, ts_headline('jiebacfg', content, websearch_to_tsquery('jiebacfg', '$q'), 'StartSel = , StopSel = ') AS highlight_content, author, title, subtitle, content, full_text_search_weighted FROM sample WHERE full_text_search_weighted @@ websearch_to_tsquery('jiebacfg', '$q') ORDER BY rank DESC LIMIT 20;"; $result = pg_query($query) or die('Query failed: ' . pg_last_error()); // Printing results in HTML echo "\n"; echo ""; while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) { echo "\t\n"; foreach ($line as $col_value) { echo "\t\t\n"; } echo "\t\n"; } echo "
rank author (hl) title (hl) subtitle (hl) content (hl) author title subtitle content TSVECTOR
$col_value
\n"; // Free resultset pg_free_result($result); // Closing connection pg_close($dbconn); } ?>