2013-07-25 170 views
1

我在我的网页上使用TipueSearch,并且我具有搜索框和结果页面(如在显示/呈现中)的功能。但是,搜索结果页面不会像显示页面的结果那样显示结果。提示搜索不显示搜索结果

这里是tipuesearch_set.js代码:

var tipuesearch_stop_words = ["and", "be", "by", "do", "for", "he", "how", "if", "is", "it", "my", "not", "of", "or", "the", "to", "up", "what", "when"]; 

var tipuesearch_replace = {"words": [ 
{"word": "tipua", replace_with: "tipue"}, 
{"word": "javscript", replace_with: "javascript"} 
]}; 

var tipuesearch_stem = {"words": [ 
{"word": "e-mail", stem: "email"}, 
{"word": "javascript", stem: "script"}, 
{"word": "javascript", stem: "js"} 
]}; 

var tipuesearch_pages = ["/", "/approvals", "/search"]; 

这里是我的new.html.erb页面结果页:

<head> 
    <link href="http://fonts.googleapis.com/css?family=Open+Sans:300,400" rel="stylesheet"> 
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> 
    <link href="tipuesearch/tipuesearch.css" rel="stylesheet"> 
    <script src="tipuesearch/tipuesearch_set.js"></script> 
    <script src="tipuesearch/tipuesearch.js"></script> 
</head> 
<body> 
    <div style="float: left;"><input type="text" id="tipue_search_input"></div> 
    <div style="float: left; margin-left: 13px;"><input type="button" id="tipue_search_button"></div> 
<div id="tipue_search_content"><div id="tipue_search_loading"></div></div> 
</body> 

<script> 
$(document).ready(function() { 
    $('#tipue_search_input').tipuesearch({ 
     'mode': 'live' 
     'liveDescription': '.header', 
     'liveContent': '.container' 
    }); 
}); 
</script> 

就像我说的,搜索栏本身就很好,结果页面就像它应该呈现的一样,唯一的问题是没有任何被搜索出现。我认为这个问题可能在tipuesearch_set.js页面,在这里我把它可以路由到的网页,

var tipuesearch_pages = ["/", "/approvals", "/search"]; 

但我可能是错的。

如果您进入提示页面http://www.tipue.com/search/docs/live/,您可以找到我正在使用的搜索类型以及获取代码的位置。

非常感谢您提供任何答案。

回答

0

好吧,首先,你错过了一个逗号(,我相信是必需的)旁边'mode': 'live'

$(document).ready(function() { 
    $('#tipue_search_input').tipuesearch({ 
     'mode': 'live', 
     'liveDescription': '.header', 
     'liveContent': '.container' 
    }); 
}); 

这应该已经产生了控制台的Expected token '}'错误。

+0

谢谢,我没有明白。我决定取消提示的想法,并采用不同的方法。不过谢谢。 –

+0

@BrettCox这是否解决了您的问题? – Charlie

+0

它没有解决它,但它有助于摆脱错误。 –