pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Ross J. Reedstrom <reedstrm@rice.edu>
To: pgsql-sql@postgresql.org
Subject: Re: counting text matches - any recipes?
Date: Mon, 4 Nov 2002 15:26:12 -0800
Message-ID: <200211041526.12931.josh@agliodbs.com> (raw)
In-Reply-To: <20021104225320.GA6001@wallace.ece.rice.edu>
References: <20021104225320.GA6001@wallace.ece.rice.edu>


Ross,

> For the basic interface, we have the user types some words into a textbox,
> then just search 'everything'. I'm weighting the results, so that hits
> on the title count more than on keywords, which count more than on the
> abstract, which count more than in the body.

Before you re-invent the wheel, have you checked out OpenFTS?  www.openfts.org 
(I think).
> 
> This is working reasonably well, but I'm stuck on one counting problem:
> what's the natural way to count multiple matches in SQL?

Within a single text field?  There isn't.

2 choices:

1) Use a Full Text Searching engine, such as the simple one in /contrib or a 
more full-featured one like OpenFTS.   Both will allow you to do counts on 
"hits" for a keyword.

2) Write a function in PL/perl which will count the number of keyword matches 
in a text string. Potentially slower than #1, but easier to implement.

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco




view thread (2+ messages)

Message-ID: <200211041526.12931.josh@agliodbs.com>
Permalink:  ../200211041526.12931.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200211041526.12931.josh@agliodbs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com, reedstrm@rice.edu
  Subject: Re: counting text matches - any recipes?
  In-Reply-To: <200211041526.12931.josh@agliodbs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox