wpsharks / wp-kb-articles

KB Articles for WordPress; adds a new Custom Post Type.
http://wpkbarticles.com/
2 stars 1 forks source link

Improve Search Box by Including Tags #29

Closed raamdev closed 9 years ago

raamdev commented 9 years ago

The Search Box properly searches KB Title and Content, but it seems that the search field does not take Tags into account.

For example, I just tried doing a search on the ZenCache KB (http://zencache.com/kb/) for html compressor, expecting it to find all the articles tagged html compressor, but instead it says "No articles matching search criteria."

2015-01-14_16-22-32 2015-01-14_16-22-41


Since we'll be using tags as 'keywords' for each article, I suggest the following priority when doing searches:

  1. Search Title
  2. Search Tags
  3. Search Content

@jaswsinc writes...

The plugin currently uses WP_Query for the search and it leaves a lot to be desired. I'd love to hear your thoughts on possible solutions to this. Google search, improve existing search to include tags? What's ideal?

I'd like to avoid using a Google search here, as that won't integrate nearly as well with the interface. Since the search already takes the Title and Content into account, I think we should just work to include tags. Even if we don't search in the priority listed above, I'd be happy just to know that tags are being considered somewhere during the search.

jaswrks commented 9 years ago

Referencing this class member that handles the call the WP_Query. https://github.com/websharks/wp-kb-articles/blob/000000-dev/wp-kb-articles/includes/classes/sc-list.php#L294

And this line in particular that deals with the search query. https://github.com/websharks/wp-kb-articles/blob/000000-dev/wp-kb-articles/includes/classes/sc-list.php#L342


I'd like to avoid using a Google search here, as that won't integrate nearly as well with the interface. Since the search already takes the Title and Content into account, I think we should just work to include tags. Even if we don't search in the priority listed above, I'd be happy just to know that tags are being considered somewhere during the search

Roger that. Sounds good to me also. I'm going to sit on this one for a bit, but I thought I'd provide some references above in case anyone else feels like taking a look and trying to improve it.

jaswrks commented 9 years ago

Also referencing: http://codex.wordpress.org/Class_Reference/WP_Query

raamdev commented 9 years ago

Referencing: http://wordpress.stackexchange.com/questions/21446/tag-search-using-wp-query

jaswrks commented 9 years ago

@raamdev @brucewsinc Tags are now searched; i.e. help in search queries.

Example: http://zencache.com/kb/?kb_q=compressor Or (same thing): http://zencache.com/kb/kb-q/compressor/ (SEO/cache-friendly)

raamdev commented 9 years ago

Tags are now searched

Woohoo! Awesome!