Skip to content
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

Potential enhancements to the Smart 404 Feature #802

Open
1 of 3 tasks
dkotter opened this issue Sep 13, 2024 · 2 comments
Open
1 of 3 tasks

Potential enhancements to the Smart 404 Feature #802

dkotter opened this issue Sep 13, 2024 · 2 comments
Labels
help wanted Extra attention is needed type:enhancement New feature or request.
Milestone

Comments

@dkotter
Copy link
Collaborator

dkotter commented Sep 13, 2024

Is your enhancement related to a problem? Please describe.

In #801, a new Smart 404 Feature was added. As mentioned in a comment, I think there are a few additional things we can look to do.

  • Add better check to ensure ElasticPress isn't just installed and active but is actually configured properly. I don't think we need to go so far as to check that our mapping exists (and thus a sync has run) but ensuring it's actually connected to elasticsearch before we allow the Feature to be set up would be nice. I'd suggest we look at the ElasticPress code to see if there's a helper function or method we can use
  • We have some helper functions that can be hardcoded into a theme's 404 template to render results but to better support FSE themes, would be nice to introduce a Smart 404 block

Designs

No response

Describe alternatives you've considered

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@dkotter dkotter added the type:enhancement New feature or request. label Sep 13, 2024
@jeffpaul
Copy link
Member

@felipeelia any advice on?:

Add better check to ensure ElasticPress isn't just installed and active but is actually configured properly. I don't think we need to go so far as to check that our mapping exists (and thus a sync has run) but ensuring it's actually connected to elasticsearch before we allow the Feature to be set up would be nice. I'd suggest we look at the ElasticPress code to see if there's a helper function or method we can use

@jeffpaul jeffpaul added this to the 3.3.0 milestone Sep 16, 2024
@jeffpaul jeffpaul added the help wanted Extra attention is needed label Sep 16, 2024
@felipeelia
Copy link
Member

If you simply want to check if the plugin connected to ES at some point in the recent past, you can use Elasticsearch::factory()->get_elasticsearch_version( false );, as seen here.

To check if a mapping exists, you can use Indexables::factory()->get( 'post' )->get_mapping() (which will actually send a request to ES) or Indexables::factory()->get( 'post' )->determine_mapping_version() to use a cached value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed type:enhancement New feature or request.
Projects
Status: To Do
Development

No branches or pull requests

3 participants