2012-12-16 08:40:08 +00:00
|
|
|
|
<?php
|
2013-06-09 03:03:47 +00:00
|
|
|
|
$__ = array('q', 'm', 'f', 's', 'p', 'ie', 'oe', 'syn', 'xml','east','west','south','north','begin','end');
|
2012-12-16 08:40:08 +00:00
|
|
|
|
foreach ($__ as $_)
|
|
|
|
|
$$_ = isset($_GET[$_]) ? $_GET[$_] : '';
|
|
|
|
|
// input encoding
|
|
|
|
|
if (!empty($ie) && !empty($q) && strcasecmp($ie, 'UTF-8'))
|
|
|
|
|
{
|
|
|
|
|
$q = XS::convert($q, $cs, $ie);
|
|
|
|
|
$eu .= '&ie=' . $ie;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// output encoding
|
|
|
|
|
if (!empty($oe) && strcasecmp($oe, 'UTF-8'))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
function xs_output_encoding($buf)
|
|
|
|
|
{
|
|
|
|
|
return XS::convert($buf, $GLOBALS['oe'], 'UTF-8');
|
|
|
|
|
}
|
|
|
|
|
ob_start('xs_output_encoding');
|
|
|
|
|
$eu .= '&oe=' . $oe;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$oe = 'UTF-8';
|
|
|
|
|
}
|
|
|
|
|
// recheck request parameters
|
|
|
|
|
$q = get_magic_quotes_gpc() ? stripslashes($q) : $q;
|
|
|
|
|
$f = empty($f) ? '_all' : $f;
|
|
|
|
|
${'m_check'} = ($m == 'yes' ? ' checked' : '');
|
|
|
|
|
${'syn_check'} = ($syn == 'yes' ? ' checked' : '');
|
|
|
|
|
${'f_' . $f} = ' checked';
|
|
|
|
|
${'s_' . $s} = ' selected';
|
|
|
|
|
$search=$this->search;
|
|
|
|
|
|
|
|
|
|
$this->headTitle($this->config->title->site);
|
2013-11-11 03:02:21 +00:00
|
|
|
|
$this->headTitle('Home');
|
|
|
|
|
$this->headTitle('Search');
|
2012-12-16 08:40:08 +00:00
|
|
|
|
$this->headTitle()->setSeparator(' - ');
|
|
|
|
|
$this->headLink()->appendStylesheet('/css/search.css');
|
2013-11-11 03:02:21 +00:00
|
|
|
|
$this->nav[] = array('link'=>"/search",'title'=>'Full Text Search');
|
2012-12-16 08:40:08 +00:00
|
|
|
|
?>
|
2013-06-02 03:52:20 +00:00
|
|
|
|
<?= $this->render('breadcrumbs.phtml'); ?>
|
2013-03-28 03:23:43 +00:00
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="span12">
|
2012-12-16 08:40:08 +00:00
|
|
|
|
<!-- search form -->
|
2013-04-09 02:25:56 +00:00
|
|
|
|
<form id="q-form" class="form-search form-inline" method="get">
|
|
|
|
|
<div id="q-input" class="input-append">
|
2013-11-11 03:02:21 +00:00
|
|
|
|
<input class="span4 search-query text" type="text" name="q" placeholder="Input any words to search" value="<?php echo htmlspecialchars($q); ?>" />
|
2013-04-09 02:25:56 +00:00
|
|
|
|
<button type="submit" class="btn">Search</button>
|
|
|
|
|
</div>
|
2013-11-11 03:02:21 +00:00
|
|
|
|
<input type="radio" name="f" value="title" <?php if (!empty($f_title)) echo $f_title; ?> />Title
|
|
|
|
|
<input type="radio" name="f" value="_all" <?php if (!empty($f__all)) echo $f__all; ?> />Fulltext
|
|
|
|
|
<input type="checkbox" name="m" value="yes" <?php echo $m_check; ?> />fuzzy
|
2013-06-09 03:03:47 +00:00
|
|
|
|
<input type="hidden" name="east" value="<?php echo $east; ?>" />
|
|
|
|
|
<input type="hidden" name="west" value="<?php echo $west; ?>" />
|
|
|
|
|
<input type="hidden" name="south" value="<?php echo $south; ?>" />
|
|
|
|
|
<input type="hidden" name="north" value="<?php echo $north; ?>" />
|
|
|
|
|
<input type="hidden" name="begin" value="<?php echo $begin; ?>" />
|
|
|
|
|
<input type="hidden" name="end" value="<?php echo $end; ?>" />
|
2013-11-11 03:02:21 +00:00
|
|
|
|
<button type="button" class="btn" id="advance">Advance</button>
|
2013-04-09 02:25:56 +00:00
|
|
|
|
<!-- <li><input type="checkbox" name="syn" value="yes" <?php echo $syn_check; ?> />同义词</li>
|
2012-12-16 08:40:08 +00:00
|
|
|
|
<li>
|
|
|
|
|
按
|
|
|
|
|
<select name="s" size="1">
|
|
|
|
|
<option value="relevance">相关性</option>
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
排序
|
2013-04-09 02:25:56 +00:00
|
|
|
|
</li>-->
|
2012-12-16 08:40:08 +00:00
|
|
|
|
</form>
|
2013-06-09 03:03:47 +00:00
|
|
|
|
<?php
|
|
|
|
|
if ($begin || $end || $east)
|
|
|
|
|
{
|
|
|
|
|
echo '<div class="well well-small">';
|
2013-11-11 03:02:21 +00:00
|
|
|
|
if ($begin || $end) echo '<span class="text-success">Temporal Range</span>';
|
|
|
|
|
if ($begin) echo 'Start: '.$begin;
|
|
|
|
|
if ($end) echo 'End: '.$end;
|
|
|
|
|
if ($east) echo '<span class="text-success">Spatial Range</span> E:'.$east.' W:'.$west.' S:'.$south.' N:'.$north;
|
2013-06-09 03:03:47 +00:00
|
|
|
|
echo '</div>';
|
|
|
|
|
}
|
|
|
|
|
?>
|
2012-12-16 08:40:08 +00:00
|
|
|
|
|
|
|
|
|
<!-- hot search -->
|
|
|
|
|
<?php if (count($this->hot) > 0): ?>
|
|
|
|
|
<div id="hot-search" class="res_div2">
|
2013-11-11 03:02:21 +00:00
|
|
|
|
<h4>Hot Search</h4>
|
2012-12-16 08:40:08 +00:00
|
|
|
|
<ul>
|
|
|
|
|
<?php foreach($this->hot as $word => $freq): ?>
|
|
|
|
|
<li><a href="/search?q=<?php echo urlencode($word); ?>"><?php echo $word; ?></a><small>(<?php echo $freq; ?>)</small></li>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
<!-- begin search result -->
|
|
|
|
|
|
|
|
|
|
<!-- neck bar -->
|
|
|
|
|
<div id="res-neck">
|
2013-11-11 03:02:21 +00:00
|
|
|
|
Hitted <strong><?php echo number_format($this->count); ?></strong> items,
|
|
|
|
|
Total <strong><?php echo number_format($this->total); ?></strong> items.
|
|
|
|
|
(Search time: <?php printf('%.4f', $this->search_cost); ?> Seconds - Page generated time: <?php printf('%.4f', $this->total_cost); ?>Seconds)
|
2012-12-16 08:40:08 +00:00
|
|
|
|
[<a href="<?php echo "$this->base_url&xml=yes&p=$p" ;?> " target="_blank">XML</a>]
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- error -->
|
|
|
|
|
<?php if (!empty($this->error)): ?>
|
2013-11-11 03:02:21 +00:00
|
|
|
|
<div id="res-error"><strong>Error: </strong><?php echo $this->error; ?></div>
|
2012-12-16 08:40:08 +00:00
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
<!-- fixed query -->
|
|
|
|
|
<?php if (count($this->corrected) > 0): ?>
|
|
|
|
|
<div id="res-fixed" class="res_div2">
|
2013-11-11 03:02:21 +00:00
|
|
|
|
<h4>Are you interested in :</h4>
|
2012-12-16 08:40:08 +00:00
|
|
|
|
<ul>
|
|
|
|
|
<?php foreach ($this->corrected as $word): ?>
|
2013-06-02 02:19:17 +00:00
|
|
|
|
<li><a href="<?php echo '/search?q=' . urlencode($word); ?>"><?php echo $word; ?></a></li>
|
2012-12-16 08:40:08 +00:00
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
<?php if (count($this->expanded) > 0): ?>
|
|
|
|
|
<div id="res-fixed" class="res_div2">
|
2013-11-11 03:02:21 +00:00
|
|
|
|
<h4>Are you interested in : </h4>
|
2012-12-16 08:40:08 +00:00
|
|
|
|
<ul>
|
|
|
|
|
<?php foreach ($this->expanded as $word): ?>
|
2013-06-02 02:19:17 +00:00
|
|
|
|
<li><a href="<?php echo '/search?q=' . urlencode($word); ?>"><?php echo $word; ?></a></li>
|
2012-12-16 08:40:08 +00:00
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- empty result -->
|
|
|
|
|
<?php if ($this->count === 0 && empty($this->error)): ?>
|
|
|
|
|
<div id="res-empty">
|
2013-11-11 03:02:21 +00:00
|
|
|
|
<p>Could not find results related with <strong><?php echo htmlspecialchars($q); ?></strong>. Recommendation: </p>
|
2012-12-16 08:40:08 +00:00
|
|
|
|
<ul>
|
2013-11-11 03:02:21 +00:00
|
|
|
|
<li>Are there some errors in your query string?</li>
|
|
|
|
|
<li>Change your query string.</li>
|
2012-12-16 08:40:08 +00:00
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
<!-- result doc list -->
|
|
|
|
|
<div id="res-list">
|
|
|
|
|
<?php foreach ($this->docs as $doc): ?>
|
|
|
|
|
<div class="res-doc">
|
|
|
|
|
<h2>
|
|
|
|
|
<a href="/data/<?php echo $doc->uuid; ?>"><?php echo $doc->rank(); ?>. <?php echo $this->search->highlight(htmlspecialchars($doc->title)); ?></a>
|
|
|
|
|
<small>[<?php echo $doc->percent(); ?>%]</small>
|
|
|
|
|
</h2>
|
|
|
|
|
<p><?php echo $search->highlight(htmlspecialchars($doc->description)); ?></p>
|
|
|
|
|
<ul>
|
2013-11-11 03:02:21 +00:00
|
|
|
|
<li><span>Keywords: </span> <?php echo $search->highlight(htmlspecialchars($doc->keyword)); ?></li>
|
|
|
|
|
<li><span>Metadata: </span> <?php echo $search->highlight(htmlspecialchars($doc->data)); ?></li>
|
2012-12-16 08:40:08 +00:00
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- pager -->
|
|
|
|
|
<?php if (!empty($this->pager)): ?>
|
|
|
|
|
<div id="res-pager" class="res_div2">
|
2013-11-11 03:02:21 +00:00
|
|
|
|
<strong>Page: </strong>
|
2012-12-16 08:40:08 +00:00
|
|
|
|
<?php echo $this->pager; ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
<!-- related query -->
|
|
|
|
|
<?php if (count($this->related) > 0): ?>
|
|
|
|
|
<div id="res-related" class="res_div2">
|
2013-11-11 03:02:21 +00:00
|
|
|
|
<h4>Related Search</h4>
|
2012-12-16 08:40:08 +00:00
|
|
|
|
<ul>
|
|
|
|
|
<?php foreach ($this->related as $word): ?>
|
|
|
|
|
<li><a href="<?php echo '/search?q=' . urlencode($word); ?>"><?php echo $word; ?></a></li>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
<!-- end search result -->
|
2013-03-28 03:23:43 +00:00
|
|
|
|
</div>
|
2012-12-16 08:40:08 +00:00
|
|
|
|
</div><!-- outer -->
|
|
|
|
|
|
|
|
|
|
<!-- load jquery from google -->
|
2014-09-02 05:20:24 +00:00
|
|
|
|
<link rel="stylesheet" href="/js/lib/jquery.ui/jquery-ui.lasted.css" type="text/css" media="all" />
|
|
|
|
|
<script type="text/javascript" src="/js/lib/jquery.ui/jquery-ui.lasted.js"></script>
|
2012-12-16 08:40:08 +00:00
|
|
|
|
|
|
|
|
|
<!-- ready script -->
|
|
|
|
|
<script language="javascript">
|
|
|
|
|
$(function(){
|
|
|
|
|
// input tips
|
|
|
|
|
$('#q-input .text').focus(function(){
|
|
|
|
|
if ($(this).val() == $(this).attr('title')) {
|
|
|
|
|
$(this).val('').removeClass('tips');
|
|
|
|
|
}
|
|
|
|
|
}).blur(function(){
|
|
|
|
|
if ($(this).val() == '' || $(this).val() == $(this).attr('title')) {
|
|
|
|
|
$(this).addClass('tips').val($(this).attr('title'));
|
|
|
|
|
}
|
|
|
|
|
}).blur().autocomplete({
|
|
|
|
|
'source':'/search/suggest',
|
|
|
|
|
'select':function(ev,ui) {
|
|
|
|
|
$('#q-input .text').val(ui.item.label);
|
|
|
|
|
$('#q-form').submit();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// submit check
|
|
|
|
|
$('#q-form').submit(function(){
|
|
|
|
|
var $input = $('#q-input .text');
|
2013-06-09 03:03:47 +00:00
|
|
|
|
/*if ($input.val() == $input.attr('title')) {
|
2012-12-16 08:40:08 +00:00
|
|
|
|
alert('请先输入关键词');
|
|
|
|
|
$input.focus();
|
|
|
|
|
return false;
|
2013-06-09 03:03:47 +00:00
|
|
|
|
}*/
|
|
|
|
|
});
|
|
|
|
|
//advance search
|
|
|
|
|
$('#advance').click(function(){
|
|
|
|
|
$('#q-form').attr('action','/search/advance');
|
|
|
|
|
$('#q-form').submit();
|
2012-12-16 08:40:08 +00:00
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
</script>
|