The apachesolr module uses variables to store its configuration data, meaning that I was able to make sure dev and staging sites didn't write to my solr index by putting a line into a local settings.inc.php file:
$conf['apachesolr_read_only'] = 1; // D6
$conf['apachesolr_environments']['acquia_search_server_1']['conf']['apachesolr_read_only'] = TRUE; // D7
This module seems to provide similar functionality for overriding the server configuration, but in my case I'd like to use the same server but in read-only mode.
Since this module has the generic name "Search API Override" and not "Search API Server Override", I thought I'd ask here if this feels like a reasonable feature request :)
Comment | File | Size | Author |
---|---|---|---|
#19 | search_api_override-override-indexes-2371091-19.patch | 14.05 KB | solideogloria |
Comments
Comment #1
derhasi CreditAttribution: derhasi commentedI couldn't have thought about any use case regarding indexes, but that seems to be a valid one. Can you provide a patch for that?
Comment #2
mvcGlad you agree it would be useful. I'll ask my client for a mandate to write that patch, and post here if that's approved.
Comment #3
brenk28 CreditAttribution: brenk28 commentedAttached a patch (against 1.0-rc1) that adds the index override functionality.
Comment #4
sheise CreditAttribution: sheise commentedThank you for the patch!
I could not get read_only to work as overridden as part of the options array as it needs be a top level item in the array.
Here's an updated patch.
Comment #5
sheise CreditAttribution: sheise commentedSorry, missed a line in my patch. Here's the correct one.
Comment #6
Jody LynnDon't add this
Comment #7
sheise CreditAttribution: sheise commentedFixed issues from comment #6.
New patch with fixes from #3 and #5.
Comment #8
sheise CreditAttribution: sheise commentedComment #9
jsst CreditAttribution: jsst at Ibuildings commentedSetting solr to readonly is easy in apachesolr, but not so using search_api. We've solved this use-case using this patch and the following settings:
I believe this patch should be merged into the 1.0 release because:
- the new feature is documented in the README file
- overriding indexes is solved in a similar fashion to how overriding servers works, without code duplication
- follows the drupal coding styleguide
Comment #10
jsst CreditAttribution: jsst at Ibuildings commentedComment #11
nlambert CreditAttribution: nlambert as a volunteer commentedI'm seeing this:
To overcome I have to save the form @admin/config/search/search_api/index/default_node_index/fields
Edit: I actually have to change a value in that form for indexing to work on an overridden index
Comment #12
DamienMcKennaComment #13
DamienMcKennaThis may not be working as intended. I have indexes configured to use Solr. I override them via search_api_override_indexes to use a database instead, like so:
However, when it runs the SearchApiDbService::indexItems() method throws an error because $this->options['indexes'] doesn't exist.
Comment #14
osopolarI ported patch to current dev version (7.x-1.0-rc1+1-dev) and did some minor changes on comments (line breaks) and:
instead of
@DamienMcKenna: Did you find the source for your problem?
There is one thing that I am wondering about, I have set
'read_only' => TRUE
it works so far as changing content won't re-index the item – (it does not change on the (solr) search server). But it gets marked as dirty, asdrush sapi-s
shows one item less indexed as before the change. Is that expected behavior?Comment #15
solideogloria CreditAttribution: solideogloria commentedRe #14, it sounds like that's right, because if you were to change the index to no longer be read-only, those "dirty" items should probably be re-indexed, right?
Also, if nobody is still complaining about issues with the current state of the patch, I think it should be moved to RTBC. I've been using patch #7 for several months, and I think the ability to override indexes should be merged into a 2nd release candidate.
Comment #16
solideogloria CreditAttribution: solideogloria commentedAlso, make sure to update README.md
Comment #17
DamienMcKennaFYI you can use the patches to override the config like so..
If you want to make the "my_index" search index use the "local_solr" config, add this to your settings.php file:
None of the 'options' values need to be given if you want to just use the existing configuration.
In my sites I've started building a local Solr config and exporting it to a Feature which I only enable locally, this reduces the amount of configuration changes / overrides necessary to make it work.
Comment #18
solideogloria CreditAttribution: solideogloria commentedDoes anyone have a good idea on what description could be added to the README.md file to document the functionality added by overriding indexes?
Comment #19
solideogloria CreditAttribution: solideogloria commentedI gave it a shot. I started with patch #14 and added an index example to the README.md based on code from previous comments.
Comment #20
solideogloria CreditAttribution: solideogloria commentedComment #21
solideogloria CreditAttribution: solideogloria commentedComment #23
vuilComment #25
vuil