Forum OpenACS Q&A: Re: DB Smarties Question :) - Inverted Index / Concordance of Unique Words in a Field

I'll take a stab at your question. I may be totally off base; though, here it is.

Given a field in a table that has multiple words separated by spaces, you'd create a stored procedure that enumerates that field in each row and splits it's contents based on whitespace. The procedure would insert each word component into a ?cursor? or temporary table. Then maybe you could run a 'group by' select call to get a distinguished list of words with their respective occurrences; e.g.,

Select Count(*), word, from my_temp group by word;

I have better knowledge of Interbase procs and can visualize a solution. I'm not that strong with respect to PostgreSQL.

In terms of the split function, PostgreSQL may have a default function to handle it:

Or, you can create your own and bind it to the pg service.

I wouldn't mind a spellchekker utility within this forum.