This happens on the admin page, where the admin can hit the checkbox "Enable spellchecker and suggestions",
http://sitename/admin/settings/apachesolr/settings

If the spellcheck is turned on, the spellcheck index rebuilds. If it is turned off, the spellcheck index rebuilds. This is happening because there is no check for the selection state, when the form is submitted.

Attaching a patch to only rebuild, when the spellcheck is enabled.

Comments

pwolanin’s picture

Version: 6.x-1.1 » 6.x-1.x-dev
Status: Active » Needs review
pwolanin’s picture

Status: Needs review » Needs work

I think the form submit handler should skip the API call if the box is not checked, rather than adding a variable check in the API function.

craig_’s picture

if we go that route, it should also be caught here, as well (also apachesolr_search.module)

function apachesolr_search_form_apachesolr_delete_index_form_alter(&$form, $form_state) {
$form['submit']['#submit'][] = 'apachesolr_search_build_spellcheck';
}

pwolanin’s picture

oh, if we are using that functuin directly as the submit handler maybe your patch is the easiest fix.

pwolanin’s picture

So - can you tell me what the problem is here? Are you having performance issues?

When deleting the index it does seems like the index should be rebuilt if the index is empty?

pwolanin’s picture

StatusFileSize
new501 bytes

Here's a patch similar to yours, but correct default and better placement outside the try{}

craig_’s picture

the issue is performance-related, in that either the system is running unneeded jobs during cron runs (to be honest, i'm not sure which cron job is calling that function, but it is getting rebuilt every day, even when disabled ... and in read-only mode), and that the admin is paying the rebuild time cost, when trying to disable the spellchecker. those are the two scenarios i am aware of

i'm ok with the default either way, as long as it can be explicitly set in the apachesolr admin screen, which it currently can. also, moving it outside the try makes sense

nick_vh’s picture

Status: Needs work » Closed (cannot reproduce)

Closing in favor of 6.x-3.x and because nobody seems to care (time of last response). If you think this is still an issue in 6.x-3.x, feel free to re-open!