Creative Problem Solver. Programmer. Bodysurfing. Sometime Comics.
Blogger since 2001.

own yr www rn! #IndieWeb

Autocomplete Results for Search

A site with a lot of content: photos and text, needs good search.

To that end I spent the day adding autocomplete to the site for all the places search exists.

I was unaware that the jQuery UI suite was included and could be queued in WordPress. Or maybe I had forgotten.

wp_enqueue_script('jquery-ui-autocomplete', '', array('jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position', 'jquery-ui-menu'), '1.12.1');

Anyway one of the niceties I added was a year indicator on the results. The older the post the darker the colors associated with the year. It helps distinguish relevance for something technical for example. I don’t think many of my programming posts more than 15 years old are relevant to anyone. The first search engine I put on this site was called “ht://dig” and it appears not to exist anymore. Even the domain is dead.

Autocomplete may be overkill for this, as I’m not propagating the text to the search field. It’s possible what I really want is just an Ajax based search. For now I’m content with the results.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.