Re: svn: /web/php/branches/PROTOTYPE_2010/ css/structure.css css/theme.css index.html js/common.js js/jquery.autocomplete.pack.js
js/search-index-en.js
| From: | Stewart Lord | Date: | Wed, 23 Dec 2009 17:24:10 +0000 |
| Subject: | Re: svn: /web/php/branches/PROTOTYPE_2010/ css/structure.css css/theme.css index.html js/common.js js/jquery.autocomplete.pack.js js/search-index-en.js |
||
| References: | 1 2 3 4 5 6 | Groups: | php.webmaster |
| Request: | Send a blank email to php-webmaster+get-6827@lists.php.net to get a copy of this message | ||
On 23-Dec-09, at 2:51 AM, Paul Dragoonis wrote:
Hi Stewart.
Your solution would be to do the following.
jQuery.getScript("js/search-index-" + getLanguage() + ".js", function(){
$('#headsearch-keywords').autocomplete(searchIndex, {
matchContains: true,
scrollHeight: 240,
formatItem: function(item) {
return item.name;
}
}).result(
function(event, item){
$.post('score.php', {itemid: item.id, itemname: item.name});
}
);
});
This will be stored in the database. That means when you're obtaining
your information via javascript (initially) - You perform a "ORDER BY
score DESC" so that the most popular scored results come first in the
list.
Hi Paul,
Thanks for your suggestion. Actually, what I am trying to do is implement scoring (entirely) client-side. The scoring itself isn't too hard to do. I'm having trouble hooking into the autocomplete plugin without modifying its source. Not sure if that's going to be possible though.
Stew