localgovdrupal / localgov_search

Default sitewide search implementation for LocalGov Drupal.
GNU General Public License v2.0
0 stars 1 forks source link

Solr search: Server and index default config #29

Closed finnlewis closed 1 year ago

finnlewis commented 2 years ago

From @ekes:

If we can reuse the index switching the server backend this will be helpful. It's probably essential for directories, news and later events. Switching indexes means duplicating views. This could be an option for search, but there would have to be a good case for doing so, it's probably really not an option for the others, though if someone has an idea how it'd work (and be maintainable) we could review.

Search, Directories, News ... modules all have a default db server config to roll out of the box working. It would be good to move these into separate modules. Then add the _solr equivalent. There is the configuration for the Search version in this module.

ekes commented 2 years ago

Just wondering do we think it's good enough that if the search index has no server attached to it that the module (_db or _solr) can inject its processor and third_party_settings in?

Or should we build a 'reset index' configuration page?

Explanation to question:

What I've done so far is removed from the index search_api.index.localgov_sitewide_search the server (it was the default db), and removed the specific processor settings from it (which were for the db). This mean that localgov_search module can be installed without a backend server. A server can then be assigned to the index. When localgov_search_db or localgov_search_solr are enabled if there is no server on that index they can enable it with theirs. But there are also the example/starter settings for processors.

These are all modules so there's no way of passing parameters to them, or asking questions when they get installed. Or not easy ways in any case. I am making the assumption that people will try out the _db and then want to try out the _solr modules, so there probably needs to be a way to change the configuration. Building some 'reset' index configuration page would be one option - more work; or just adding to the README that to swap the configuration you have to detach the index by removing the server, and then assuming it's ok to wipe whatever processor configuration if the index has no server when the submodule is enabled.

ekes commented 2 years ago

A marginally tweaked solr config for lando/quick-start roll-out in https://github.com/localgovdrupal/localgov_project/tree/feature/2.x/localgov_search-29

ekes commented 2 years ago

I'm thinking maybe make it with hook_requirements so that you don't have _db and _solr enabled at the same time; when you uninstall one it removes itself from the index. When you install one of them and there is no server attached it adds its properties.

finnlewis commented 2 years ago

Sounds reasonable @ekes

It would be good if someone enabled one of the servers along with the index if it all wired together without further configuration, but maybe that's not super important.

Just tried the localgov_project branch and https://github.com/localgovdrupal/localgov_search/tree/feature/1.x/29-db-solr

When I try to enable the LocalGov Search Solr module I get a fail with:

Unable to install LocalGov Search Solr, search_api_solr.solr_field_type.text_en_6_0_0, search_api_solr.solr_field_type.text_en_7_0_0, search_api_solr.solr_field_type.text_phonetic_en_7_0_0 already exist in active configuration.

Edit: looks like the config is in search_api_solr/config/optional and localgov_search/modules/localgov_search_solr/config/install

ekes commented 2 years ago

When I try to enable the LocalGov Search Solr module I get a fail with:

There's a good reason it's a draft :-P I've already fixed that here while writing the tests which of course threw that up as an issue.

ekes commented 1 year ago

We have now a seperate solr module.