[GENERAL] ranking how similar are tsvectors was: OR tsquery

2010-01-17 Thread Ivan Sergio Borgonovo
My initial request was about a way to build up a tsquery that was made similar to what plainto_tsquery does but using | inspite of as a glue. But at the end of the day I'd like to find similar tsvectors and rank them. I've a table containing several fields that contribute to build up a weighted

Re: [GENERAL] ranking how similar are tsvectors was: OR tsquery

2010-01-17 Thread Oleg Bartunov
Ivan, You can write function to get lexemes from tsvector: CREATE OR REPLACE FUNCTION ts_stat(tsvector, weights text, OUT word text, OUT ndoc integer, OUT nentry integer) RETURNS SETOF record AS $$ SELECT ts_stat('SELECT ' || quote_literal( $1::text ) || '::tsvector', quote_literal(

Re: [GENERAL] ranking how similar are tsvectors was: OR tsquery

2010-01-17 Thread Ivan Sergio Borgonovo
On Sun, 17 Jan 2010 20:19:59 +0300 (MSK) Oleg Bartunov o...@sai.msu.su wrote: Ivan, You can write function to get lexemes from tsvector: CREATE OR REPLACE FUNCTION ts_stat(tsvector, weights text, OUT word text, OUT ndoc integer, OUT nentry integer) RETURNS SETOF record AS $$ SELECT

Re: [GENERAL] Ranking search results using multiple fields in PostgreSQL fulltext search

2009-10-13 Thread Gaini Rajeshwar
On Mon, Oct 12, 2009 at 8:02 PM, Ivan Sergio Borgonovo m...@webthatworks.it wrote: On Mon, 12 Oct 2009 19:26:55 +0530 Gaini Rajeshwar raja.rajeshwar2...@gmail.com wrote: Ivan, If i create a tsvector as you mentioned with concatenation operator, my search query will search in any of

[GENERAL] Ranking search results using multiple fields in PostgreSQL fulltext search

2009-10-12 Thread Gaini Rajeshwar
Hi, is there a way to rank the search results based on multiple fields in postgreSQL? For example, i have *title*, *abstract*, *summary*, *body* as fields/columns in my database. When user searches on *title*, i want to rank the results based on *title* field as well as *summary* field, where

Re: [GENERAL] Ranking search results using multiple fields in PostgreSQL fulltext search

2009-10-12 Thread Raymond O'Donnell
On 12/10/2009 14:16, Gaini Rajeshwar wrote: Hi, is there a way to rank the search results based on multiple fields in postgreSQL? For example, i have *title*, *abstract*, *summary*, *body* as fields/columns in my database. When user searches on *title*, i want to rank the results based on

Re: [GENERAL] Ranking search results using multiple fields in PostgreSQL fulltext search

2009-10-12 Thread Raymond O'Donnell
On 12/10/2009 14:23, Raymond O'Donnell wrote: Hoe do you define importance? Whoops... for Hoe read How :-) Ray. -- Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland r...@iol.ie Galway Cathedral Recitals:

Re: [GENERAL] Ranking search results using multiple fields in PostgreSQL fulltext search

2009-10-12 Thread Gaini Rajeshwar
I think you misunderstood my question. let me give clear idea about what i need. I am using PostgreSQL fulltext search (tsearch2) feature to implement searching on database. From readings i came to know that we can give weights to different fields in database something like this:

Re: [GENERAL] Ranking search results using multiple fields in PostgreSQL fulltext search

2009-10-12 Thread Ivan Sergio Borgonovo
On Mon, 12 Oct 2009 18:46:02 +0530 Gaini Rajeshwar raja.rajeshwar2...@gmail.com wrote: Hi, is there a way to rank the search results based on multiple fields in postgreSQL? For example, i have *title*, *abstract*, *summary*, *body* as fields/columns in my database. When user searches on

Re: [GENERAL] Ranking search results using multiple fields in PostgreSQL fulltext search

2009-10-12 Thread Ivan Sergio Borgonovo
On Mon, 12 Oct 2009 19:11:01 +0530 Gaini Rajeshwar raja.rajeshwar2...@gmail.com wrote: I think you misunderstood my question. let me give clear idea about what i need. I am using PostgreSQL fulltext search (tsearch2) feature to implement searching on database. From readings i came to know

Re: [GENERAL] Ranking search results using multiple fields in PostgreSQL fulltext search

2009-10-12 Thread Gaini Rajeshwar
Ivan, If i create a tsvector as you mentioned with concatenation operator, my search query will search in any of these fields which are concatenated in my tsvector. For example, if i create tsvector like this, UPDATE document_table SET search_col = setweight(to_tsvector(coalesce(title,'')), 'A')

Re: [GENERAL] Ranking search results using multiple fields in PostgreSQL fulltext search

2009-10-12 Thread Ivan Sergio Borgonovo
On Mon, 12 Oct 2009 19:26:55 +0530 Gaini Rajeshwar raja.rajeshwar2...@gmail.com wrote: Ivan, If i create a tsvector as you mentioned with concatenation operator, my search query will search in any of these fields which are concatenated in my tsvector. For example, if i create tsvector like

Re: [GENERAL] Ranking search results using multiple fields in PostgreSQL fulltext search

2009-10-12 Thread Gaini Rajeshwar
On Mon, Oct 12, 2009 at 7:26 PM, Ivan Sergio Borgonovo m...@webthatworks.it wrote: On Mon, 12 Oct 2009 19:11:01 +0530 Gaini Rajeshwar raja.rajeshwar2...@gmail.com wrote: I think you misunderstood my question. let me give clear idea about what i need. I am using PostgreSQL fulltext

[GENERAL] Ranking?

2008-08-22 Thread Ruben Gouveia
Since there is no current solution to ranking values in pl/pgsql as the rank() over (partition by... that there is in oracle i am hoping someone can help me out here. The table i created contains the following columns: rank | value I wrote a cursor that will give me all the

Re: [GENERAL] Ranking?

2008-08-22 Thread David Fetter
On Fri, Aug 22, 2008 at 02:30:46PM -0700, Ruben Gouveia wrote: Since there is no current solution to ranking values in pl/pgsql as the rank() over (partition by... that there is in oracle i am hoping someone can help me out here. It seems likely that the windowing functions patch will get

Re: [GENERAL] Ranking Results

2005-09-14 Thread Thomas O'Connell
On Sep 13, 2005, at 3:07 PM, Craig wrote: Hi   I have a query that is grouping by 3 fields and returning a sum of another field. I would also like a further field to be returned that shows a ranking for the records based on the sum field. This should really only be a numbering of the rows

[GENERAL] Ranking Results

2005-09-13 Thread Craig
Hi I have a query that is grouping by 3 fields and returning a sum of another field. I would also like a further field to be returned that shows a ranking for the records based on the sum field. This should really only be a numbering of the rows returned, since I will do the ordering in an

[GENERAL] Ranking values within a query (pseudo-ROWNUM)

2004-06-24 Thread Jeff Boes
I hope this helps someone else ... I had struggled some time ago with attempts to get a rank of values query to work, but then I gave up and set it aside. I had another reason to attack it, and in between then and now I learned how to return setof values from a function, as well as how to

[GENERAL] Ranking values within a query (pseudo-ROWNUM) **fixed**

2004-06-24 Thread Jeff Boes
Gah, I'm dreadfully sorry. The original functions were cut-and-pasted from a \df+ window, which meant they lost their quoted-ness, which means if you try to cut and paste from my message to a SQL prompt, you'll be sorely disappointed. Below are the edited versions. create table