[GENERAL] Using POSIX Regular Expressions on xml type fields gives inconsistent results

2012-12-20 Thread Denis Papathanasiou
I have a table with an xml type column, and while I can make regex queries like this successfully: => select id from form_d where 'kumar' ~* any( CAST(xpath('//PersonsList/PersonName/LastName/text()', data) as TEXT[]) ); id -- 97e1541b-27f

Re: [GENERAL] Using POSIX Regular Expressions on xml type fields gives inconsistent results

2012-12-21 Thread Denis Papathanasiou
Hi David, On 12/20/2012 08:48 PM, David Johnston wrote: -Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general- ow...@postgresql.org] On Behalf Of Denis Papathanasiou Sent: Thursday, December 20, 2012 7:56 PM To: pgsql-general@postgresql.org Subject: [GENERAL

Re: [GENERAL] Using POSIX Regular Expressions on xml type fields gives inconsistent results

2012-12-21 Thread Denis Papathanasiou
On 12/21/2012 10:35 AM, David Johnston wrote: If you look at the four examples which follow the posix match table in the docs (http://www.postgresql.org/docs/9.1/static/functions- matching.html#FUNCTIONS-POSIX-TABLE), some of them work from the left side, e.g.: 'abc' ~ '(b|d)' true In my orig

[GENERAL] Optimal indexing of Full Text Search (ts_vector & ts_query) columns?

2010-08-21 Thread Denis Papathanasiou
After reading the documentation on Full Text Search here http://www.postgresql.org/docs/8.4/interactive/textsearch-tables.html I created the following table and index: CREATE TABLE item ( pk uuid primary key, ... [more columns here] ... searchable_text text not null ); CREATE INDEX item_

[GENERAL] Optimal indexing of Full Text Search (ts_vector & ts_query) columns?

2010-08-21 Thread Denis Papathanasiou
After reading the documentation on Full Text Search here http://www.postgresql.org/docs/8.4/interactive/textsearch-tables.html I created the following table and index: CREATE TABLE item ( pk uuid primary key, ... [more columns here] ... searchable_text text not null ); CREATE INDEX ite

[GENERAL] Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index?

2010-08-25 Thread Denis Papathanasiou
As a follow-up to my question from this past Saturday (http://archives.postgresql.org/pgsql-general/2010-08/msg00624.php), I experimented with adding two types of indices to the same text column: CREATE INDEX item_eng_searchable_text_idx ON item USING gin(to_tsvector('english', searchable_text));

Re: [GENERAL] Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index?

2010-08-25 Thread Denis Papathanasiou
Not per se, but maybe looking at the actual outputs of the two function calls would be enlightening. I suspect you'll find that the search conditions you are getting are not equivalent. Strictly speaking they're not, b/c the plainto_tsquery() is chaining several tokens together. However, a

Re: [GENERAL] Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index?

2010-08-25 Thread Denis Papathanasiou
we need examples of your explain analyze. I don't want to waste my time reading theoretical reasoning :) Here's an actual 'explain analyze' example: alerts=> CREATE INDEX node_val_tsv_idx ON node USING gin(to_tsvector('english', val)); CREATE INDEX alerts=> explain analyze select item_pk fr

Re: [GENERAL] Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index?

2010-08-26 Thread Denis Papathanasiou
That index doesn't match the query, so it can't be used. Try select item_pk from node where tag='primaryIssuer.entityType' and to_tsvector('english', val) @@ plainto_tsquery('Limited Partnership'); Tom and Oleg: thank you for clarifying this. I see where I made the mistake in applying the e