10up / ElasticPress

A fast and flexible search and query engine for WordPress.
https://elasticpress.io
GNU General Public License v2.0
1.25k stars 312 forks source link

Explore "Weightable" class #2812

Open oscarssanchez opened 2 years ago

oscarssanchez commented 2 years ago

Is your enhancement related to a problem? Please describe.

Describe the solution you'd like

Currently, fields that can be weighted are limited to post types. Since ElasticSearch offers weighting across different fields, such as date, index, etc, offering a way to add new weights outside of the standard way we have now would be good.

Designs

Describe alternatives you've considered

Additional context

Jeetshahcl commented 2 years ago

How to put weightage i tried but its not on wp_query can you please help me on this

Jeetshahcl commented 2 years ago

@felipeelia please help me i am stuck.

nickchomey commented 2 years ago

@oscarssanchez I am making good progress on the BuddyPress Integration (#3) and would like to add metaboxes to the Search Fields and Weightings feature in order to be able to tweak things from the GUI. But unfortunately there aren't any filters/mechanisms for this yet.

I'd be happy to work on this if you can give me some direction on how you'd like for it to be done.

I'm thinking that it would be best to

  1. leave the Posts-related stuff in Weightings.php alone, for simplicity's sake
  2. Add something like abstract public function render_settings_section(); to Feature.php, and then a corresponding function in each of the Features' extended class to do whatever is necessary to generate the settings section for their respective Indexables (I've got many for the singular BP Feature - activity post, forum posts, groups, etc...).
  3. Finally add some minimal code in the Weightings.php render_settings_page() function to just grab an array of the active Features, and then loop through each Feature's respective render_settings_section() function to retrieve/echo the content.

I don't really want to start on such an effort without some assurance that it'll actually get used/merged, which will surely require that I adhere to your/10up's standards. So, I hope you'll be able to provide some guidance on the above. What do you think?

nickchomey commented 2 years ago

I see this PR https://github.com/10up/ElasticPress/pull/2588 that might be related, but it isn't at all clear to me what it does given the lack of explanation/details...

nickchomey commented 2 years ago

@oscarssanchez I wonder if this should be related with the call to action in the 4.3 release for ideas for Facets enhancements? We should be able to both extend the Custom Fields and Weights feature and then use those in Facets as well. Again, I'm eager to contribute to this - I just need to be pointed in the right direction.