Skip to main content.
home | support | download

Back to List Archive

Re: Using swish-e from *within* a database

From: David L Norris <dave(at)not-real.webaugur.com>
Date: Mon Jul 12 2004 - 20:09:43 GMT
On Mon, 2004-07-12 at 11:59 -0700, David Fishburn wrote:
> CALL swishe_create_index( table_name, index_name, column_list );
> -- This stored procedure would connect to the database and use the -S
> interface to select out those columns and index them like a typical spider.
> It would use the primary key of the table as the "name" of the document.

This would have to be a system() call or something similar since there's
no indexing interface in the API.  But it is quite doable as an external
process.  You could have a function which initiates the process of
indexing but runs the swish-e command externally.


> You could possibly reindex daily, or one some schedule or event.
> 
> Unknowns:
> 1.  I am not sure what interfaces swish-e provides to retrieve its
> configuration parameters.

None.

> I was thinking of creating a table and storing
> each configuration item on a newline in the table.  The library can retrieve
> these values from the database, or pass them in as a parameter.

You'd have to generate a config file to pass to the swish-e command.
But it is possible.

> 2.  Does swish-e have to create a file for the index, or could you store the
> result of the index in a LONG BINARY column in the database itself.  Then
> when the search is done, you can just load the index from the database.
> 3.  If 2 does not work, then we can store the absolute path name to the
> file, and go that route.

It doesn't strictly have to be a file.  SWISH-E supports a modular
backend.  However, you would have to write your own backend to store the
index in your database.

> 4.  I assume we would have a separate file/index per table, but that depends
> on your implementation.

You could do one index per table or store metadata in the index to
indicate the table.  For example, you could use swishdocpath to store
the table name instead of a filename.

> Has anyone attempted something along these lines before?

A number of people have used SWISH-E to replace MySQL's full text
search.  But I don't know of any attempts to write procedure language
extensions for any databases.  I think main stumbling block may be that
SWISH-E doesn't support unicode and I think most databases use unicode
internally.

-- 
 David Norris
  http://www.webaugur.com/dave/
  ICQ - 412039
Received on Mon Jul 12 13:10:06 2004