Provides a hook_uninstall which:
* Deletes all variables for search rankings (apart from standard node search rankings)
* Deletes variable search_index_unique

Comments

douggreen’s picture

Thanks! (This was part of a (GHOP Task).

I think you're missing a variable_del('search_node_links').

Also, I'd explicitly name the rankings to skip, because if you rely on views_fastsearch_search_ranking(), it's possible that you'll miss one or two of them if they were disabled (but not uninstalled). So instead of calling views_fastsearch_search_ranking, just use array('....', '....', '...') for all the values to remove. Then you might try to figure out some php array function that will give you all values that are in one array and not in another. Just a suggestion. What do you think?

douggreen’s picture

Status: Needs review » Needs work
corsix’s picture

StatusFileSize
new1.09 KB

I can't find any mention of search_node_links in the module:

E:\Drupal>"C:\Program Files\TortoiseCVS\cvs.exe" -d :pserver:anonymous:anonymous
@cvs.drupal.org:/cvs/drupal-contrib -q checkout -r DRUPAL-5--2 -P contributions/
modules/views_fastsearch
U contributions/modules/views_fastsearch/README.txt
U contributions/modules/views_fastsearch/views_fastsearch.info
U contributions/modules/views_fastsearch/views_fastsearch.install
U contributions/modules/views_fastsearch/views_fastsearch.module

E:\Drupal>cd contributions\modules\views_fastsearch

E:\Drupal\contributions\modules\views_fastsearch>grep search_node_links *.*

E:\Drupal\contributions\modules\views_fastsearch>

array_diff would be the perfect function to use in this situation, however the PHP manual states that it was broken in PHP 4.0.4, so as long as Drupal supports PHP4, it is not desirable to use it. Using an explicit list is a better idea, so changed to use it.

corsix’s picture

Status: Needs work » Needs review
douggreen’s picture

Hmm, it looks like I've been accidentally developing on the DRUPAL-5 branch instead of the DRUPAL-5--2 branch. I'll need to fix this tomorrow. But, please check out the DRUPAL-5 branch and you'll see the missing variable.

Did you spend any time trying to get the following lines to two lines, using a php array function?

    $standard_rankings = array('node_rank_relevance', 'node_rank_recent', 'node_rank_comments', 'node_rank_views');
    foreach ($standard_rankings as $rank => $values) {
      unset($ranking[$rank]);
    }

I think that one of the array_diff functions might do it.

corsix’s picture

StatusFileSize
new1.11 KB

I don't think the array_diff functions are applicable:
array_diff_assoc: Works on key/value pairs, whereas we want keys
array_diff_key: Requires PHP >= 5.1.0RC1
array_diff_uassoc: Requires PHP 5
array_diff_ukey: Requires PHP >= 5.1.0RC1
array_diff: Works on values, whereas we want keys

corsix’s picture

Then again, you could do:

    $standard_rankings = array('node_rank_relevance', 'node_rank_recent', 'node_rank_comments', 'node_rank_views');
    $ranking = array_diff(array_keys($ranking), $standard_rankings);

    foreach ($ranking as $rank) {
      variable_del($rank);
    }
dmitrig01’s picture

Yes that's ideal

corsix’s picture

StatusFileSize
new1.09 KB

Ok, using that :)

corsix’s picture

StatusFileSize
new1.09 KB

changed + // ignore the standard node_rankings
to + // Ignore the standard node_rankings

dmitrig01’s picture

Status: Needs review » Reviewed & tested by the community

Good to go!

douggreen’s picture

Status: Reviewed & tested by the community » Fixed

This is already committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.