How to make keywords in search function more advanced

Hi, please I need some referral to anyone here who can help to customize the search function of listing hive to enable the query to pick up the different words in the search keywords and not return “Nothing found” when there are listings to find.

Thank you

Hi,

Could you please clarify if you want to search by custom attributes? If so, you can enable the Indexable option for each attribute to achieve this.

Hope this helps

Hi Kseniia thanks for your response.

I have already made my attributes indexable.

My website is a health directory.
The problem is people search our listings with long keywords like “where can I do city scan in abc area”, " clinics offering dental implants services in abc area". Now instead of the results to show CT scan or dental implantation services which are amongst the services listed, “nothing found” is displayed. Which make people leave the website.

So, I’d like the search function to pick the words that match listed services from the long keywords.

Can you be of help.

Thank you.

Hi @Fida,

I’m not 100% sure if this will work, but I found this snippet in another topic that might do the trick.

add_filter(
	'hivepress/v1/models/listing/attributes',
	function( $attributes ) {
		if ( isset( $attributes['location'] ) ) {
			$attributes['location']['indexable'] = true;
		}

		return $attributes;
	},
	1000
);

“How to add custom code snippets - HivePress Help Center” How to add custom code snippets - HivePress Help Center

I hope this helps!

Cheers,
Chris :victory_hand:

1 Like

By default, HivePress relies on the built-in WordPress search functions. If you need features like autocomplete for the search bar or support for word forms and synonyms, you can consider using a third-party plugin such as WP Search with Algolia – WordPress plugin | WordPress.org.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.