Uploaded image for project: 'Planet4'
  1. Planet4
  2. PLANET-4923

Search query is executed twice on each initial search page load

    XporterXMLWordPrintable

    Details

    • Type: Task
    • Status: CLOSED
    • Priority: Should have
    • Resolution: Released
    • Affects Version/s: None
    • Fix Version/s: 2.32.0
    • Labels:
      None
    • Story Points:
      4
    • Sprint:
      Sprint #135
    • Section:
      Code Refactoring, Search
    • P4 site:
      All sites
    • Track:
      Development
    • P4 Test Environment:
      jupiter
    • Repositories:
      planet4-plugin-gutenberg-blocks

      Description

      Currently our search code is executed after the "main WordPress loop". In this main loop the search query is executed, however in our search code we build another search query (has some different parameters than the one in the main loop!) and execute it. We only use the result of the second query.

      We should only be executing a single query. This could be done in 2 ways:

      1. Make our search code work with the "main" loop. Seems to make most sense but could be a lot of work to make all our logic work with that.
      2. Keep the current code and prevent the main query from being executed. End result is more complex, but could be a quick fix. Can be done by unsetting the filter from the ElasticPress plugin.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                pvincent Pieter Vincent
                Reporter:
                pvincent Pieter Vincent
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: