Обсуждение: Adding an alternate syntax for Phrase Search
Folks, This came up at pgCon. The 'word <-> word <-> word' syntax for phrase search is not developer-friendly. While we need the <-> operator for SQL and for the sophisticated cases, it would be really good to support an alternate syntax for the simplest case of "words next to each other". My proposal is enclosing the phrase in double-quotes, which would be intuitive to users and familiar from search engines. Thus: to_tsquery(' Berkus & "PostgreSQL Version 10.0" ') ... would be equivalent to: to_tsquery(' Berkus & ( PostgreSQL <-> version <-> 10.0 )') I realize we're already in beta, but pgCon was actually the first time I saw the new syntax. I think if we don't do this now, we'll be doing it for 10.0. -- -- Josh Berkus Red Hat OSAS (any opinions are my own)
On 22 May 2016 at 18:52, Josh berkus <josh@agliodbs.com> wrote: > Folks, > > This came up at pgCon. > > The 'word <-> word <-> word' syntax for phrase search is not > developer-friendly. While we need the <-> operator for SQL and for the > sophisticated cases, it would be really good to support an alternate > syntax for the simplest case of "words next to each other". My proposal > is enclosing the phrase in double-quotes, which would be intuitive to > users and familiar from search engines. Thus: > > to_tsquery(' Berkus & "PostgreSQL Version 10.0" ') > > ... would be equivalent to: > > to_tsquery(' Berkus & ( PostgreSQL <-> version <-> 10.0 )') > > I realize we're already in beta, but pgCon was actually the first time I > saw the new syntax. I think if we don't do this now, we'll be doing it > for 10.0. I think it's way too late for that. I don't see a problem with including it for 10.0, but when the feature freeze has long passed and we also have our first beta out, it's no longer a matter of changing the design or additional functionality, unless there's something that absolutely requires modification. This isn't that. Thom
On 22 May 2016 at 18:52, Josh berkus <josh@agliodbs.com> wrote:
> Folks,
>
> This came up at pgCon.
>
> The 'word <-> word <-> word' syntax for phrase search is not
> developer-friendly. While we need the <-> operator for SQL and for the
> sophisticated cases, it would be really good to support an alternate
> syntax for the simplest case of "words next to each other". My proposal
> is enclosing the phrase in double-quotes, which would be intuitive to
> users and familiar from search engines. Thus:
>
> to_tsquery(' Berkus & "PostgreSQL Version 10.0" ')
>
> ... would be equivalent to:
>
> to_tsquery(' Berkus & ( PostgreSQL <-> version <-> 10.0 )')
>
> I realize we're already in beta, but pgCon was actually the first time I
> saw the new syntax. I think if we don't do this now, we'll be doing it
> for 10.0.
I think it's way too late for that. I don't see a problem with
including it for 10.0, but when the feature freeze has long passed and
we also have our first beta out, it's no longer a matter of changing
the design or additional functionality, unless there's something that
absolutely requires modification. This isn't that.
Particularly in light of our annual major release cycle we need to be open to usability recommendations during Beta 1 (at minimum). Not everyone with intelligence, insight, and meaningful uses for our product and features follows -hackers and compiles from source to try things out during development. We should encourage these others to at least voice their opinions on the new features.
Its not like we get inundated with these kinds of requests. Let it remain mostly a resource concern. If a few people can agree on desirability and get a patch written, reviewed, and ready-for-commit before the next beta release then the release committee, with input from the community, can be the final arbiter of whether to back-patch it into 9.6 or keep it for 10.0
I'd like to think that features are the "top-level capabilities" that we introduce - this is a sub-component of the "phrase search" feature. Component freeze should occur no earlier than after the second packaged release. I'd generally rather have feature freeze earlier and use the added time for component work and additional general testing if keeping on the yearly cycle doesn't allow for both. But, I'm tending to think that we are that tightly constrained generally.
David J.
> to_tsquery(' Berkus & "PostgreSQL Version 10.0" ') > > ... would be equivalent to: > > to_tsquery(' Berkus & ( PostgreSQL <-> version <-> 10.0 )') select to_tsquery('Berkus') && phraseto_tsquery('PostgreSQL Version 10.0'); does it as you wish > > I realize we're already in beta, but pgCon was actually the first time I > saw the new syntax. I think if we don't do this now, we'll be doing it > for 10.0. Havn't an objections for 10.0 -- Teodor Sigaev E-mail: teodor@sigaev.ru WWW: http://www.sigaev.ru/
to_tsquery(' Berkus & "PostgreSQL Version 10.0" ')
... would be equivalent to:
to_tsquery(' Berkus & ( PostgreSQL <-> version <-> 10.0 )')
select to_tsquery('Berkus') && phraseto_tsquery('PostgreSQL Version 10.0');
does it as you wish
Sure, but I imagine (not having used it myself), that in cases involving user input said text treated somewhat holistically and it wouldn't be all that easy, or desirable, to choose between the two forms at runtime.
David J.
On 05/22/2016 06:53 PM, Teodor Sigaev wrote: > >> to_tsquery(' Berkus & "PostgreSQL Version 10.0" ') >> >> ... would be equivalent to: >> >> to_tsquery(' Berkus & ( PostgreSQL <-> version <-> 10.0 )') > > select to_tsquery('Berkus') && phraseto_tsquery('PostgreSQL Version 10.0'); > does it as you wish Aha, you didn't mention this in your presentation. That seems plenty good enough for 9.6. -- -- Josh Berkus Red Hat OSAS (any opinions are my own)
On Thu, May 26, 2016 at 3:00 PM, Josh berkus <josh@agliodbs.com> wrote: > On 05/22/2016 06:53 PM, Teodor Sigaev wrote: >> >>> to_tsquery(' Berkus & "PostgreSQL Version 10.0" ') >>> >>> ... would be equivalent to: >>> >>> to_tsquery(' Berkus & ( PostgreSQL <-> version <-> 10.0 )') >> >> select to_tsquery('Berkus') && phraseto_tsquery('PostgreSQL Version 10.0'); >> does it as you wish > > Aha, you didn't mention this in your presentation. That seems plenty > good enough for 9.6. Will add this to the slides. > > -- > -- > Josh Berkus > Red Hat OSAS > (any opinions are my own) > > > -- > Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-hackers