Skip to content

Fix for broken relevant search in issue 359 #361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

PaulAnnekov
Copy link
Contributor

I have added the Relevanssi plugin to mu-plugins folder and added its initialization during a site installation phase. Try it.

Issue: Search at api.jquery.com gives inaccurate results.

@scottgonzalez
Copy link
Member

So this requires re-installing all the sites in order for searching to work?

@PaulAnnekov
Copy link
Contributor Author

@scottgonzalez we have multiple options:

  1. If you have some sort of one-time tasks then we can set up Relevanssi there.
  2. You can launch a piece of php code that I can write to set up Relevannsi on live server.
  3. We can add some special flag (maybe using get_option/update_option) that indicates that plugin was not set up and launch setup depending on it.

@scottgonzalez
Copy link
Member

@jquery/infrastructure How do you want to handle this?

@PaulAnnekov
Copy link
Contributor Author

@scottgonzalez Any progress?

@scottgonzalez
Copy link
Member

I'm really not sure what we should do. I feel like whatever solution we use has to Just Work, otherwise everyone will end up with broken sites.

@nacin thoughts?

@PaulAnnekov
Copy link
Contributor Author

Ok, as I understand I need to implement third approach:

We can add some special flag (maybe using get_option/update_option) that indicates that plugin was not set up and launch setup depending on it.

We will check some flag on each request and update Relevanssi settings if they are not set up yet.

@scottgonzalez
Copy link
Member

Ok, let's try that out.

@PaulAnnekov
Copy link
Contributor Author

@scottgonzalez I took the time and moved Relevanssi installation from blog install to blog init (on each user request). Now it will "Just Work" :).

@PaulAnnekov
Copy link
Contributor Author

hey, guys, let's close this bug

@arthurvr
Copy link
Member

I'm still interested in hearing @nacin's thoughts on this.

@PaulAnnekov
Copy link
Contributor Author

@arthurvr so will he say anything? :)

@deltab
Copy link

deltab commented Aug 15, 2016

Still waiting? :-)

@PaulAnnekov
Copy link
Contributor Author

lol, yes :)

@mgol
Copy link
Member

mgol commented Jul 26, 2017

@scottgonzalez @gnarf @Krinkle who would be best to review this?

@Krinkle
Copy link
Member

Krinkle commented Jul 26, 2017

I can give this a shot, although I don't have rights in this specific repo at the moment.

@PaulAnnekov Can you clarify how mu-plugins/relevanssi-install.php is meant to be loaded? From a quick glance it's unclear to me whether it gets loaded at all, and if so, what ensures it will load after the main plugin.

The previous way of calling a function explicitly was easier to follow. I've been working on various WordPress sites, plugins, and themes for years, but don't have much experience with MU/Multisite yet (aside from the occasional fix on jQuery sites).

I thought perhaps -install.php is a special pattern in our custom code or in WordPress, but that doesn't seem to be the case. Am I correct in assuming you're essentially registering relevanssi-install.php as its own plugin? And it is not loaded via _loader.php, but rather loaded directly by WordPress itself (given _loader only considers specific sub directories)? If so, then I assume the idea is that WordPress loads first _loader.php (including the main plugin), and then later loads relevanssi-install.php. That should work, so long WordPress uses sorted load order and not the default opendir() order (Edit: confirmed, sorts before inclusion)

Copy link
Member

@Krinkle Krinkle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit. After this and clarification per the above, I'm willing to land this and verify on staging.

@@ -14,4 +14,5 @@
}
unset( $live_domain, $subdomain, $domain_specific_file, $type_specific_file );

require_once(WPMU_PLUGIN_DIR . '/relevanssi/relevanssi.php');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using require_once like a function with parenthesis. Instead, use it as a statement like the line below.

@PaulAnnekov
Copy link
Contributor Author

PaulAnnekov commented Jul 28, 2017

@Krinkle this article will answer ALL your questions https://codex.wordpress.org/Must_Use_Plugins. WordPress runs only directly placed in mu-plugins files. In alphabetical order. The whole process is like this:

  1. _loader.php loaded. It includes relevanssi plugin. As article above says, no plugin hooks will run.
  2. relevanssi-install.php is running. It checks if it's not root blog and jquery_relevanssi_installed flag is not set. If it's true, it's starting installation process, setting custom config and jquery_relevanssi_installed flag to do not repeat this process again.

That's it.

I have fixed what you requested.

mgol pushed a commit to mgol/jquery-wp-content that referenced this pull request Feb 11, 2018
@mgol
Copy link
Member

mgol commented Feb 11, 2018

I rebased & squashed this PR and re-submitted as #408.

I'd like to land it but I don't have enough WordPress+PHP expertise to review it thouroughly.

@Krinkle are you confident it's OK to land #408? If so, I'll do it but I'd like some kind of confirmation.

mgol pushed a commit to mgol/jquery-wp-content that referenced this pull request Feb 11, 2018
@Krinkle
Copy link
Member

Krinkle commented Feb 11, 2018

@mgol Aye, yeah, let's close this pull in favour of #408.

@mgol mgol closed this in 94345a8 Feb 14, 2018
mgol pushed a commit that referenced this pull request Mar 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

8 participants