我在网页上使用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"];
但我可能是错的。
如果您进入 Tipue 页面 http://www.tipue.com/search/docs/live/您可以找到我正在使用的搜索类型以及我从哪里获取代码。
预先感谢您的任何答复。
最佳答案
好吧,首先,您在 'mode': 'live'
: 旁边缺少一个逗号(我认为这是必需的)
$(document).ready(function() {
$('#tipue_search_input').tipuesearch({
'mode': 'live',
'liveDescription': '.header',
'liveContent': '.container'
});
});
这应该会在您的控制台中产生 Expected token '}'
错误。
关于javascript - 提示搜索不显示搜索结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17862524/