Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qxS1X-000xwi-Hq for pgsql-bugs@arkaria.postgresql.org; Mon, 30 Oct 2023 13:09:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qxS1V-00Djko-V0 for pgsql-bugs@arkaria.postgresql.org; Mon, 30 Oct 2023 13:09:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qxS1V-00Djkg-BX for pgsql-bugs@lists.postgresql.org; Mon, 30 Oct 2023 13:09:41 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qxS1S-0033Br-N3 for pgsql-bugs@lists.postgresql.org; Mon, 30 Oct 2023 13:09:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=momjian.us; s=2023062407; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description; bh=KTA56fvtvQ+flqPHZhr7wfatdWtzNNspHTjBgP6ctz0=; b=Tk6+Z 7kcRrUHy7P9osQYwGWQJAw3gqSQMSiPgfAfApFLfiMexwD8jaVhBjqSjxggl/o6Tc3WDIgVW+q0nI Ldz9YrhZqdIzZYhSTTvRGBz1nib+WryB3BHXvreJlyehAO+WZKTUL7fo44fEg517j+ci2MdBNgX5/ ah9fkIi97jm6WiiNLGYg7FBSrPz/t6MzL8oDnjfITexAvVU42Zz98SoXL+EmBEG5sNzyLGg5eCTsL jnkQI5e2K57OuS66o/UNjHQjQppxmO6WlE7JJgSJNxesCJWfEOJHAWIZN899AQol9MPR7QlcX79j5 S0vUjOatUpFA7QTpwow0qgHDwL5tQ==; Received: from bruce by momjian.us with local (Exim 4.96) (envelope-from ) id 1qxS1P-00ERVp-0n; Mon, 30 Oct 2023 09:09:35 -0400 Date: Mon, 30 Oct 2023 09:09:35 -0400 From: Bruce Momjian To: Tom Lane Cc: Alex Malek , pgsql-bugs@lists.postgresql.org, ngigi@at.co.ke Subject: Re: BUG #15172: Postgresql ts_headline with <-> operator does not highlight text properly Message-ID: References: <152461454026.19805.6310947081647212894@wrigleys.postgresql.org> <1995601.1698526000@sss.pgh.pa.us> <2140529.1698594815@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="+PeDBquLR30EP4Zd" Content-Disposition: inline In-Reply-To: <2140529.1698594815@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --+PeDBquLR30EP4Zd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Oct 29, 2023 at 11:53:35AM -0400, Tom Lane wrote: > Bruce Momjian writes: > > Attached is a proposed doc patch. > > As I pointed out before, the fragments *don't* necessarily satisfy > the query, so this is still promising too much. > > An important edge case to keep in mind is that the given text > itself might not satisfy the query; ts_headline has no control > over what you hand it. But even if the text as a whole does, > there may not be small fragments that do. How is this weasel-wording, attached. :-) -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Only you can decide what is important to you. --+PeDBquLR30EP4Zd Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="headline.diff" diff --git a/doc/src/sgml/textsearch.sgml b/doc/src/sgml/textsearch.sgml index 1550be5695..aa728fa3f8 100644 --- a/doc/src/sgml/textsearch.sgml +++ b/doc/src/sgml/textsearch.sgml @@ -1287,7 +1287,10 @@ ts_headline( config ts_headline accepts a document along with a query, and returns an excerpt from - the document in which terms from the query are highlighted. The + the document in which terms from the query are highlighted. + Specifically, the function will use the query to return relevant + text fragments, and highlight all words that appear in the query, + even if those words do not match the query operator restrictions. The configuration to be used to parse the document can be specified by config; if config is omitted, the --+PeDBquLR30EP4Zd--