modify js for fess-suggest
This commit is contained in:
parent
87ed935934
commit
2c47e7c3a9
2 changed files with 8 additions and 12 deletions
|
@ -20,8 +20,8 @@ $(function(){
|
|||
|
||||
$('#contentQuery').suggestor( {
|
||||
ajaxinfo: {
|
||||
url: contextPath + '/json',
|
||||
fn: 'content',
|
||||
url: contextPath + '/suggest', // TODO rename
|
||||
fn: 'keyword',
|
||||
num: 10
|
||||
},
|
||||
boxCssInfo: {
|
||||
|
|
|
@ -102,9 +102,8 @@ $.fn.suggestor = function(setting) {
|
|||
type:"get",
|
||||
dataType: "jsonp",
|
||||
cache : false,
|
||||
data:{ query: $textArea.val(),
|
||||
type: "suggest",
|
||||
fn: settingAjaxInfo.fn,
|
||||
data:{ q: $textArea.val(),
|
||||
fields: settingAjaxInfo.fn,
|
||||
num: settingAjaxInfo.num * 2
|
||||
}
|
||||
}).done(function(obj) { suggestor.createAutoCompleteList(obj); }).fail(function(a,obj,b) { suggestingSts=false; return; });
|
||||
|
@ -113,19 +112,16 @@ $.fn.suggestor = function(setting) {
|
|||
|
||||
|
||||
createAutoCompleteList: function(obj) {
|
||||
var response = obj.response;
|
||||
var hits = obj.hits;
|
||||
var suggestor = this;
|
||||
var addCount = 0;
|
||||
|
||||
|
||||
listNum = 0;
|
||||
if(typeof response.result !== "undefined") {
|
||||
if(typeof hits !== "undefined") {
|
||||
var reslist = new Array();
|
||||
for(var i=0;i<response.result.length;i++) {
|
||||
var tmpList = response.result[i].result;
|
||||
for(var j=0;j<tmpList.length;j++) {
|
||||
reslist.push(tmpList[j]);
|
||||
}
|
||||
for(var i=0;i<hits.length;i++) {
|
||||
reslist.push(hits[i].text);
|
||||
}
|
||||
var $olEle = $("<ol/>");
|
||||
$olEle.css("list-style","none");
|
||||
|
|
Loading…
Add table
Reference in a new issue