Site maintenance: Sun 15 Nov, from 12:00 UTC, about 4–6 hours. Details

This cutover relies on some testing that is still incomplete so may be cancelled at short notice

Forums / Contribution-Writing Guidelines / How to add indexes and drop them?

How to add indexes and drop them?

Started by ajweb on 2 Apr 2011, 5:05 PM · Views: 2,143

Results 1 to 2 of 2
2 Apr 2011, 5:05 PM
#1
ajweb avatar

ajweb

New Zenner

Join Date:
Feb 2011
Posts:
1
Plugin Contributions:
0

How to add indexes and drop them?

I would like to make a contribution public, it uses fulltext indexes on products_description name and description fields to allow relevance ordered search results.

The code is working fine (an observer), but I am not sure if my current method to add and drop the indexes is right.

I create the indexes transparently the first time the observer is run (on the first search after installation). This takes a while on big catalogs, but allows for very easy installation (no need to manually run SQL which confuses a lot of users).

And I still don't know how to drop the indexes if the user wants to uninstall the whole thing. My first thought was to give the SQL statements for copy/paste on the admin>tools>sql patches, but seems to fail, with no messages. Is it perhaps disallow to run DROP statements from there? Should I better provide a PHP script for all DB modification ? An admin page?

3 Apr 2011, 6:56 PM
#2
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: How to add indexes and drop them?

AJweb:

I would like to make a contribution public, it uses fulltext indexes on products_description name and description fields to allow relevance ordered search results.

The code is working fine (an observer), but I am not sure if my current method to add and drop the indexes is right.

I create the indexes transparently the first time the observer is run (on the first search after installation). This takes a while on big catalogs, but allows for very easy installation (no need to manually run SQL which confuses a lot of users).

And I still don't know how to drop the indexes if the user wants to uninstall the whole thing. My first thought was to give the SQL statements for copy/paste on the admin>tools>sql patches, but seems to fail, with no messages. Is it perhaps disallow to run DROP statements from there? Should I better provide a PHP script for all DB modification ? An admin page?

Drop statements still are able to be run through the SQL Patches screen, I've done this enough times to recognize it. Are you using the DROP INDEX statement by chance?