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

Add Support for Phrase Matching #29

Closed
kevinfodness opened this issue Aug 18, 2022 · 2 comments · Fixed by #67
Closed

Add Support for Phrase Matching #29

kevinfodness opened this issue Aug 18, 2022 · 2 comments · Fixed by #67
Assignees
Labels
elasticsearch Requires understanding Elasticsearch php Requires understanding PHP

Comments

@kevinfodness
Copy link
Member

kevinfodness commented Aug 18, 2022

User Story

As a user, I want to be able to enter a phrase in quotes and only see results that match that phrase, e.g., "cool beans" should only match "cool" followed by "beans" rather than each word individually (as is the current default).

Acceptance Criteria

  • Add a new method to the controller called enable_phrase_matching that, when called as part of configuration, causes phrase matching to be turned on for all queries that are run through the search implementation.

Implementation Details

Example of how this could be used in code:

add_action(
	'elasticsearch_extensions_config',
	 function( $es_config ) {
		$es_config->enable_phrase_matching();
	 }
);
  • When enabled, search queries should be evaluated for text in double quotes, which should be included in the search as a match_phrase.
  • Any other text in the search, not in quotes, should be searched for normally.
  • The solution should support multiple phrase searches in the same query (e.g., "quick brown" fox "jumped over").
  • This feature should be opt-in and should be disabled by default.
  • There should be a corresponding disable_phrase_matching function to turn this feature off, which could be used by plugins or themes conditionally to unset this setting in particular contexts (otherwise there would be no way to turn it off once it was turned on).
@mboynes
Copy link
Contributor

mboynes commented Oct 11, 2023

We have prior art for this, reach out about that before beginning work on this.

@kevinfodness kevinfodness added elasticsearch Requires understanding Elasticsearch php Requires understanding PHP labels Oct 18, 2023
@jakewrfoster jakewrfoster linked a pull request Nov 20, 2023 that will close this issue
@jakewrfoster jakewrfoster linked a pull request Jan 31, 2024 that will close this issue
@jakewrfoster
Copy link
Member

closed by #67

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
elasticsearch Requires understanding Elasticsearch php Requires understanding PHP
Projects
None yet
3 participants