Justin,

Content Finder is a convenient and effective tool to search through content. And the auto-complete function that you mention among future plans would make it even easier to use. As a matter of fact, I took the initiative, and implemented this feature as an experiment. I will be posting a patch for your review shortly. Please let me know if this is something you would be interested in as a potential addition to the module.

Thanks,
Gergely

Comments

glekli’s picture

Status: Active » Needs review
StatusFileSize
new5.65 KB

The attached patch adds auto-complete to the search field. Initially auto-complete is based on keywords (axes), and when a keyword is present, auto-complete is based on its possible values.

When 'type:' is entered, it auto-completes existing node types; for 'status:', it auto-completes 'published' and 'unpublished'. For date searches, auto-complete suggests the current and 2 previous years, when day and month is entered. This logic may be changed as needed.

A possible addition would be to auto-complete for node titles for 'like:', or when no keyword is present.

Gergely

jemond’s picture

Status: Needs review » Active

Thanks for working on this! When I apply the patch and test locally, I get this error when I start to type "typ"

###

An error occurred.
https://devtopia.com/droptopia/admin/content/contentfinder/autocomplete
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Content Finder: Droptopia</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="/droptopia/misc/favicon.ico" type="image/x-icon" />
<link type="text/css" rel="stylesheet" media="all" href="/droptopia/sites/all/modules/contrib/admin_menu/admin_menu.css?H" />
<link type="text/css" rel="stylesheet" media="all" href="/droptopia/modules/node/node.css?H" />
<link type="text/css" rel="stylesheet" media="all" href="/droptopia/modules/system/admin.css?H" />
<link type="text/css" rel="stylesheet" media="all" href="/droptopia/modules/system/defaults.css?H" />
<link type="text/css" rel="stylesheet" media="all" href="/droptopia/modules/system/system.css?H" />
<link type="text/css" rel="stylesheet" media="all" href="/droptopia/modules/system/system-menus.css?H" />
<link type="text/css" rel="stylesheet" media="all" href="/droptopia/modules/user/user.css?H" />
<link type="text/css" rel="stylesheet" media="all" href="/droptopia/sites/all/modules/contrib/cck/theme/content-module.css?H" />
<link type="text/css" rel="stylesheet" media="all" href="/droptopia/sites/all/modules/contrib/filefield/filefield.css?H" />
<link type="text/css" rel="stylesheet" media="all" href="/droptopia/sites/all/modules/contrib/mollom/mollom.css?H" />
<link type="text/css" rel="stylesheet" media="all" href="/droptopia/sites/all/modules/contrib/cck/modules/fieldgroup/fieldgroup.css?H" />
<link type="text/css" rel="stylesheet" media="all" href="/droptopia/sites/all/modules/contrib/views/css/views.css?H" />
<link type="text/css" rel="stylesheet" media="all" href="/droptopia/sites/all/themes/rootcandy/style.css?H" />
<link type="text/css" rel="stylesheet" media="screen" href="/droptopia/sites/all/themes/rootcandy/icons.css?H" />
<script type="text/javascript" src="/droptopia/sites/all/modules/contrib/jquery_update/replace/jquery.min.js?H"></script>
<script type="text/javascript" src="/droptopia/misc/drupal.js?H"></script>
<script type="text/javascript" defer="defer" src="/droptopia/sites/all/modules/contrib/admin_menu/admin_menu.js?H"></script>
<script type="text/javascript" src="/droptopia/sites/all/modules/contrib/mollom/mollom.js?H"></script>
<script type="text/javascript" src="/droptopia/misc/autocomplete.js?H"></script>
<script type="text/javascript" src="/droptopia/misc/tableheader.js?H"></script>
<script type="text/javascript" src="/droptopia/sites/all/themes/rootcandy/rootcandy.js?H"></script>
<script type="text/javascript" src="/droptopia/sites/all/themes/rootcandy/slider/slide.js?H"></script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
jQuery.extend(Drupal.settings, { "basePath": "/droptopia/", "admin_menu": { "margin_top": 1 } });
//--><!]]>
</script>
</head>

<body class="sidebar-left admin-content-contentfinder-autocomplete-typ">

<!-- Layout -->
<div id="toppanel">
<div id="panel">
<div id="slider-left">
</div>
<div id="slider-right">
</div>
<div id="slider-middle">
</div>
</div> <!-- /login -->
<div id="toppanel-head">
<div id="go-home">
<a href="/droptopia/">Go Back to Homepage</a> </div>
<div id="admin-links">
<a href="/droptopia/user" class="user-name">justin</a> | <a href="/droptopia/logout">Logout</a> </div>
<div id="header-title" class="clearfix">
<ul id="toggle"><li><a id="open" class="open" href="#"><span class="panel-open">Open Panel</span></a><a id="close" style="display: none;" class="close" href="#"><span class="panel-close">Close Panel</span></a></li></ul>
</div>
</div>
</div>
<div id="page-wrapper"><div id="page-wrapper-content">
<div id="navigation" class="clearfix i header-on">
<div class="item-list"><ul><li href="admin" title="Dashboard" class="admin first"><a href="/droptopia/admin"><img src="/droptopia/sites/all/themes/rootcandy/icons/i24/admin/admin.png" alt="" title="" width="22" height="22" /><br />Dashboard</a></li>
<li href="admin/content" title="Content" id="current-24" class="admin-content"><a href="/droptopia/admin/content"><img src="/droptopia/sites/all/themes/rootcandy/icons/i24/admin/admin-content.png" alt="" title="" width="22" height="22" /><br />Content</a></li>
<li href="admin/build" title="Building" class="admin-build"><a href="/droptopia/admin/build"><img src="/droptopia/sites/all/themes/rootcandy/icons/i24/admin/admin-build.png" alt="" title="" width="22" height="22" /><br />Building</a></li>
<li href="admin/settings" title="Configuration" class="admin-settings"><a href="/droptopia/admin/settings"><img src="/droptopia/sites/all/themes/rootcandy/icons/i24/admin/admin-settings.png" alt="" title="" width="22" height="22" /><br />Configuration</a></li>
<li href="admin/user" title="Users" class="admin-user"><a href="/droptopia/admin/user"><img src="/droptopia/sites/all/themes/rootcandy/icons/i24/admin/admin-user.png" alt="" title="" width="22" height="22" /><br />Users</a></li>
<li href="admin/reports" title="Reports" class="admin-reports"><a href="/droptopia/admin/reports"><img src="/droptopia/sites/all/themes/rootcandy/icons/i24/admin/admin-reports.png" alt="" title="" width="22" height="22" /><br />Reports</a></li>
<li href="admin/help" title="Help" class="admin-help last"><a href="/droptopia/admin/help"><img src="/droptopia/sites/all/themes/rootcandy/icons/i24/admin/admin-help.png" alt="" title="" width="22" height="22" /><br />Help</a></li>
</ul></div>
<img src="/droptopia/sites/all/themes/rootcandy/logo.png" alt="Droptopia" id="logo" /> </div>

<div id="breadcrumb" class="alone">
<h2 id="title">Content Finder</h2> <div class="breadcrumb"><a href="/droptopia/">Home</a> » <a href="/droptopia/admin">Dashboard</a> » <a href="/droptopia/admin/content" title="Manage your site&#039;s content.">Content management</a></div> </div>

<div id="content-wrap">
<div id="inside">
<div id ="sidebar-left">
<ul id="rootcandy-menu"><li class="menu-28 first"><a href="/droptopia/admin/content/node" title="View, edit, and delete your site&#039;s content.">Content</a></li>
<li class="menu-2337 active-trail active"><a href="/droptopia/admin/content/contentfinder" title="An easier way to find content in your site.">Content Finder</a></li>
<li class="menu-29"><a href="/droptopia/admin/content/types" title="Manage posts by content type, including default status, front page promot

glekli’s picture

Did this appear in a pop-up window? It looks like the autocomplete callback returns html, instead of json. I suspect the path does not point to the correct callback function. Does a menu rebuild do any good?

jemond’s picture

This was totally my fault! Doh! I didn't clear cache. Fixed. This is working great. Committing shortly. I just need to refine the layout of the clear buttons.

jemond’s picture

Status: Active » Closed (fixed)

Looks good. Closing issue. Thanks again for this excellent patch!

jemond’s picture

Status: Closed (fixed) » Active

One thing: It seems like you have to hit enter twice, if you hit enter before the callback completes. Can this be avoided?

glekli’s picture

I am not sure we have easy control over that, since the autocomplete function is handled by Form API.
There is a discussion, however, that covers this and offers a script that might prevent it from happening: http://drupal.org/node/573574