Make search_api_db_defaults comment dependency optional

Created on 6 March 2023, over 1 year ago
Updated 10 July 2023, 12 months ago

Problem/Motivation

search_api_db_defaults currently depends von the comment module to be enabled and "article" to have a comment field. Still I think many real life projects don't use the comment module, if they're not community projects.

So would it be possible perhaps to split that off or make it optional? Otherwise this submodule simple can't be used in all such cases :(

Steps to reproduce

Proposed resolution

Remaining tasks

Feature request
Status

Active

Version

1.0

Component

Defaults module

Created by

🇩🇪Germany Anybody Porta Westfalica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇦🇹Austria drunken monkey Vienna, Austria

    Thanks for posting this suggestion!
    However, that the Defaults module is only usable in very specific scenarios is by design. We deliberately assumed that someone had just set up the site using the “Standard” profile and not made any changes, and provide a search setup for exactly that. This allows everyone to at least evaluate the module as simply as possible.
    Making this in any way compatible with specific changes made by the user would be a lot more complicated, and also soon grow out of control. After all, there are a lot of other customizations users could do to their site setup. We definitely cannot cover all of those with the Defaults module.

    Still, I’m going to leave this open. If there is enough support for this specific feature, maybe we will implement it.

    In the meantime, one workaround would be to temporarily install the Comment module, enable comments for articles and then installing the Defaults module. You can uninstall both Comments and Defaults right away after that, the search setup will still be there and will be adapted according to the now missing fields. Or, of course, you could temporarily edit the Defaults module to make the necessary changes to the config in there, then install it. As before, you can (and should) uninstall it again right away, and also revert your changes to the module’s code.

  • 🇩🇪Germany Anybody Porta Westfalica

    Thank you very much for your feedback @drunken monkey. Totally understandable! I agree that might be complicated.

    Perhaps there's a way to find a more simple solution. Let me drill that down to the key aspects:

    Problem / Motivation:
    Replace the Drupal Core Search with Search API Database Search best practices, without having to install optional modules (here: Comments)

    I guess in quite many cases you want to replace the Drupal Core Search (would be so great to have Search API DB in core to replace core search :D), for example because core search doesn't support partial search and other important techniques, which users today "simply expect to work".
    Starting from scratch with Search API (DB) is quite complicated for many site builders and risky to make mistakes.

    So what would be great (this is just a proposal, I know this could be complicated) is to provide default configurations in submodules to replace (with improvements):

    • Core node search
    • Core user search

    using best practices defined by the Search API (DB) experts.

    Searching comments and other entities could then be added on top. I guess the points above would meet the requirements of a many users, while only a few use comments.

    And let me say again: This just describes a demand and an idea for improvement. I know it's not that easy to solve. And it might be something totally different from the current search_api_db_defaults.

  • 🇪🇪Estonia veskimees

    Well, I just ran into the same problem. And for some reason, putting the Comments field back to Article doesn't work (Comment module is enabled, the corresponding field was simply removed from Article).
    It's not hard to install a clean site to see what that Default module suggests, but it still seems... odd.
    (I am working on upgrading the D7 site; an online magazine, about 2000 articles; all the content is Articles with additional fields and no comments and has been so for 12 years... I wanted to improve the search as part of the upgrade, and here I am now... :-) )

  • 🇺🇸United States bcobin

    I'm running into the same issue - no matter what I do, Drupal search is not picking up node titles (making Search pretty much useless) and I was hoping that this module might help me to create a usable search. After reading comment #4 (this is also an online magazine with about 1,000 articles), I'm not even going to try.

    In the meantime, if anybody can suggest how I can get plain old core Search to see note titles and forget about Search API, that would be great.

    Thanks in advance...

Production build 0.69.0 2024