Making WordPress.org

Opened 5 months ago

Closed 4 months ago

#7814 closed defect (bug) (fixed)

Photo Directory: Tags are not used in search results

Reported by: ryelle's profile ryelle Owned by:
Milestone: Priority: normal
Component: Photo Directory Keywords: has-patch
Cc:

Description

The search results should be including tags in the fields searched, but that doesn't appear to be working.

For example, searching for "afterglow" should return any of these photos, as they're all tagged "afterglow", but it returns an empty result.

Attachments (1)

7814.diff (482 bytes) - added by ryelle 5 months ago.

Download all attachments as: .zip

Change History (9)

@ryelle
5 months ago

#1 @ryelle
5 months ago

In my local testing, it seemed to be the change in [12543] which flipped the "LIKE" to "REGEXP", so the tag_where_for_search function wasn't inserting the where clause.

7814.diff fixed the issue locally, but when I tried applying it to my sandbox it didn't have any effect, so I'm not sure if something else is going on, or if there's a caching layer I didn't catch.

#2 @ryelle
4 months ago

@coffee2code The search customizations aren't used on production because it uses Jetpack Search (ElasticSearch), is that expected? Is there code somewhere controlling the ElasticSearch or sync process? I imagine that the tags are not synced(?), so that's why it's not returning anything for this query.

This also affects #7815.

#3 @coffee2code
4 months ago

In 14180:

Photo Directory, Search: Fix to include tags in search query.

Props ryelle.
See [12543].
See #7814.

#4 @coffee2code
4 months ago

@ryelle The use of Jetpack Search on the site is not explicit (as in I didn't directly enable it or account for it). As such, there is no site-specific code to customize its behavior. I'm not familiar with Jetpack Search so offhand I'm not sure what needs to be done to it or why it doesn't pick up properly registered custom taxonomies.

But indeed, I've confirmed the searches you cited fail to return results on dotorg/sandbox even after applying your necessary patches, though directly executing the MySQL queries, or running the site locally, returns expected results.

#5 @ryelle
4 months ago

If it's not intended, and in fact is not working correctly, it should probably be disabled. It can be disabled from the UI but I wouldn't trust it to not re-enable, I've had some experiences like that. The search handling can be simply turned off with a filter:

add_filter( 'jetpack_search_should_handle_query', '__return_false' );

Which can be removed later if the sync & ElasticSearch queries are configured.

#6 @ryelle
4 months ago

In 14224:

Photo Directory: Prevent ElasticSearch from being used on search results.

When active, ElasticSearch takes over the searching process and ignores the customization to search custom taxonomies, and prevents the core behavior of combining search and taxonomy filtering. Disabling it allows the search code to run as expected.

See #7814, #7815

#7 @ryelle
4 months ago

@coffee2code I've committed that filter disabling ElasticSearch, because the new design makes these combined queries (#7815) easy to do. If that works, both tickets can be closed. If that should just be a temporary workaround, the tickets can stay open as tasks to make work with ElasticSearch. What do you think?

#8 @coffee2code
4 months ago

  • Resolution set to fixed
  • Status changed from new to closed

@ryelle Excellent! Everything now works as expected. I consider these two tickets closed until there is a compelling reason to switch to ES. Thanks!

Note: See TracTickets for help on using tickets.