Skip to content

FEAT: Build Search Index with a button #228

Open

Description

@physikerwelt

The documentation says:

Build Search Index (Step 3/3)
Run the following maintenance scripts to build the search index:
php extensions/CirrusSearch/maintenance/UpdateSearchIndexConfig.php
php extensions/CirrusSearch/maintenance/ForceSearchIndex.php --skipParse
php extensions/CirrusSearch/maintenance/ForceSearchIndex.php --skipLinks --indexOnSkip

You will need to re-run these whenever you add new properties to the configuration.

Similar to SMW it would be nice if there would be a button to build the search index. Especially when the configuration can be done on the wiki it has (unfortunately) turned out to be a burden for admins to log into the server shell.

Activity

  1. added
    feature
    UX
    on Mar 8, 2025
  2. JeroenDeDauw commented on Mar 8, 2025

    @JeroenDeDauw
    Member

    Building the search index can take a long time, so this is not trivial to implement well.

  3. physikerwelt commented on Mar 9, 2025

    @physikerwelt
    ContributorAuthor

    Building the search index can take a long time, so this is not trivial to implement well.

    I know from mathsearch, but I saw that this is possible for SMW so I was hoping that one could copy that mechanism.

  4. physikerwelt commented on Mar 18, 2025

    @physikerwelt
    ContributorAuthor

    One approximation might be to run

    php extensions/CirrusSearch/maintenance/ForceSearchIndex.php --skipParse && php extensions/CirrusSearch/maintenance/ForceSearchIndex.php --skipLinks --indexOnSkip
    

    in an infinite loop in a dedicated docker container. Does this command destroy the existing index, or can the search be used as before while the script is running?

    ^^ This can be implemented in just a few minutes

    The next best approximation would be to store the revision of the page and only run the script if the revision was changed.

    ^^ This would be some work, maybe 1-2 hours.

  5. JeroenDeDauw commented on Mar 18, 2025

    @JeroenDeDauw
    Member

    I looked into this, and it turns out the rebuild is incremental. So yes, running it in a loop should theoretically not cause disruption to the search experience.

  6. malberts commented on Mar 20, 2025

    @malberts
    Contributor

    ForceSearchIndex.php creates new jobs. I tested running that 3 times leads to a ~3x increase in runJobs execution time. And the actual jobs take longer to complete than the ForceSearchIndex.php run itself. So it likely isn't a good idea to run this in a loop, or at least the interval between ForceSearchIndex.php runs should exceed the time to actually finish all the jobs.

  7. physikerwelt commented on Mar 20, 2025

    @physikerwelt
    ContributorAuthor

    @malberts thank you. That makes it more complicated. Maybe the simplest functional algorithm is:

    $last_revion_of_settigs_page = 0
    do:
      if ( getRevisionOfSettingsPage() > $last_revion_of_settigs_page ):
         $last_revion_of_settigs_page = getRevisionOfSettingsPage();
         cancelEsWriteJobs();
         startIndexing();
    
    
  8. JeroenDeDauw commented on Mar 20, 2025

    @JeroenDeDauw
    Member

    That seems reasonable logic when using the job queue. Though I think it is best to avoid using the job queue, if possible. If you can execute the logic directly in your script without it being deferred to jobs, you end up with a simpler system, and you can't interfere with things that need to be jobs. The point of the job queue is to defer work, but this simply isn't needed/desired for this reindexing use case.

  9. physikerwelt commented on Mar 20, 2025

    @physikerwelt
    ContributorAuthor

    I don’t know how I could achieve that. It would be better if some mechanism could be built into the extension, as all users of the extension will face this problem.

  10. physikerwelt commented on Mar 28, 2025

    @physikerwelt
    ContributorAuthor

    I realized that reindexing is triggered when the templates change. Maybe the same machnism can be used when the on wiki config changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    UXfeature

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions