<?php
if($_GET["search"] == 'search'){
$txtKeyWords =$_GET ["txtKeyWords"];
$jobsortids = $_GET ["jobsort"];
$callingids = $_GET ["calling"];
$degreeids = $_GET["degree"];
$areaids = $_GET["area"];
$propertyids =$_GET["property"];
$sizeids = $_GET["comSize"];
$workyearids = $_GET["workyear"];
$isCustom =$_GET["isCustom"];
//print_r($jobsortids);
require ("sphinxapi.php" );
$cl = new SphinxClient ();
$cl->SetServer ('localhost', 9312);
$cl->SetConnectTimeout(3);//设置超时时间
$cl->SetMatchMode (SPH_MATCH_EXTENDED2);//设置匹配模式
$cl->SetRankingMode (SPH_RANK_WORDCOUNT);//设置评分模式
$cl->SetFieldWeights (array("station"=>10,"content"=>5,"other_need"=>5)); //设置权重
//$cl->SetSortMode(SPH_SORT_RELEVANCE);
$cl->SetSortMode( SPH_SORT_EXTENDED, "issue_time DESC, @id DESC" );
//$cl->UpdateAttributes("info_job;delta_info_job",array("job_type"),array(1=>array('2')))
$cl->SetArrayResult (true);
if(isset($jobsortids) && is_array($jobsortids)){
$cl->SetFilter('jobsort_ids',$jobsortids);
}
if(isset($callingid) && is_array($callingids)){
$cl->SetFilter('calling_ids',$callingids);
}
if(isset($areaids) && is_array($areaids)){
$cl->SetFilter('area_id',$areaids);
}
if(isset($degreeids) && is_array($degreeids)){
$cl->SetFilter('degree_id',$degreeids);
}
if(isset($propertyids) && is_array($propertyids)){
$cl->SetFilter('property_id',$propertyids);
}
if(isset($sizeids) && is_array($sizeids)){
$cl->SetFilter('size_id',$sizeids);
}
if($isCustom)
{
if(isset($workyearids) && is_array($workyearids)){
$cl->SetFilter('work_year_id',$workyearids);
}
}
else
{
if(isset($workyearids) && is_array($workyearids)){
$cl->SetFilter('work_year_min',$workyearids[0]);
$cl->SetFilter('work_year_max',$workyearids[1]);
}
}
$cl->SetLimits (0,20);//显示第几页面,一页多少数据
//$resa =$cl->BuildKeywords ($txtKeyWords,"info_job;delta_info_job",true);
$res = $cl->Query ( $txtKeyWords, "info_job;delta_info_job" );
if(is_array($res[matches])){
foreach($res[matches] as $jobInfo){
$job_ids[] = $jobInfo['id'];
}
echo implode(',',$job_ids);
}
echo "共有{$res['total_found']}条结果,当前显示 {$res['total']},用时{$res['time']}<br/>分词结果:";
if(is_array($res[words])){
foreach($res[words] as $key=>$value){
echo '<br />〈'.$key.'〉';
foreach($value as $k=>$v)
{
if($k=='docs'){
echo '匹配到:'.$v.'条数据,';
}
if($k=='hits'){
echo '找到关键词:'.$v.'个。';
}
}
}
}
//print_r($res);
$cl->Close();
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<link rel="shortcut icon" href="http://images.cqjob.com/images/favicon.ico" />
<link rel="stylesheet" type="text/css" href="http://images.cqjob.com/Css/basefront_hb.css?v=20120802" />
<link rel="stylesheet" type="text/css" href="http://www.cqjob.com/css/search_hb.css" />
<script language="javascript" type="text/javascript" src="http://js.cqjob.com/Js/dragonVerSummary.js?v=20121130"></script>
<script language="javascript" type="text/javascript" src="http://js.cqjob.com/Js/jquery.validate.js?v=20110601"></script>
<script language="javascript" type="text/javascript" src="dragonVerControl.js"></script>
<script language="javascript" type="text/javascript" src="http://js.cqjob.com/Js/dragonVerPager.js?v=20121031"></script>
<script language="javascript" type="text/javascript" src="http://js.cqjob.com/Js/jquery.autocomplete.js?v=20110601"></script>
<script language="javascript" type="text/javascript" src="http://js.cqjob.com/Js/dragonVerJquery.email.tip.js?v=20120802" ></script>
</head>
<body>
<form action="test_coreseek.php" id="formJobSearch">
<input type="hidden" value="abc" name="btntest[]">
<input type="button" value="ok" id="btnOkff">
<input type='hidden' name='search' value='search'>
<div class="content">
<div class="search jSearch">
<div class="searchCon">
<div class="teamLst">
<div id="keyWordsConditions" class="team keyTeam">
<div class="teamL">关键字</div>
<div class="teamR">
<span class="verText"><input type="text" class="inputText inputGray" name="txtKeyWords" id="txtKeyWords"></span>
<span class="verTxt">
<a id="btnSaveJobSeeker" href="javascript:void(0);">保存为搜索器</a>
<a href="/MapSearch.aspx">地图找工作</a><a id="btnEmailBook" href="javascript:void(0);">邮件订阅</a>
</span>
</div>
</div>
<div class="team">
<div class="teamL">职位类别</div>
<div class="teamR">
<span class="selBtn">
<a name="btnFuntype" id="btnFuntype" href="javascript:void(0);"><b>不限</b></a><em></em>
</span>
</div>
</div>
<div class="team">
<div class="teamL">行业类别</div>
<div class="teamR">
<span class="selBtn">
<a name="btnIndustry" id="btnIndustry" href="javascript:void(0);"><b>不限</b></a><em></em>
</span>
</div>
</div>
<div class="team">
<div class="teamL">工作地区</div>
<div class="teamR">
<span class="selBtn">
<a name="btnArea" id="btnArea" href="javascript:void(0);"><b>不限</b></a><em></em>
</span>
</div>
</div>
<div class="team">
<div class="teamL">学历要求</div>
<div class="teamR">
<span class="selBtn">
<a name="btnDegree" id="btnDegree" href="javascript:void(0);"><b>不限</b></a><em></em>
</span>
</div>
</div>
<div class="team">
<div class="teamL">公司性质</div>
<div class="teamR">
<span class="selBtn">
<a name="btnProperty" id="btnProperty" href="javascript:void(0)"><b>不限</b></a><em></em>
</span>
</div>
</div>
<div class="team">
<div class="teamL">公司规模</div>
<div class="teamR">
<span class="selBtn">
<span class="selBtn">
<a name="btnCompanySize" id="btnCompanySize" href="javascript:void(0);"><b>不限</b></a><em></em>
</span>
</span>
</div>
</div>
<div class="team">
<div class="teamL">发布时间</div>
<div class="teamR">
<span class="verSelect"><input type="hidden" value="90" name="selIssueTime" id="selIssueTime"><span onClick="toggleItemLi(this)" class="verSelectBg"><span class="verSelectTxt" style="width:182px;">三个月内</span></span><span class="verSelectCon" style="height:150px;overflow:auto;height:150px;overflow:auto;width:218px;overflow-y:scroll;height:120px"><ul><li onClick="chooseItem(this,false,"");return false;"><a thevalue="00" title="请选择" href="javascript:void(0);">请选择</a></li><li onClick="chooseItem(this,false,"");return false;"><a thevalue="1" title="1天内" href="javascript:void(0);">1天内</a></li><li onClick="chooseItem(this,false,"");return false;"><a thevalue="3" title="3天内" href="javascript:void(0);">3天内</a></li><li onClick="chooseItem(this,false,"");return false;"><a thevalue="7" title="一周内" href="javascript:void(0);">一周内</a></li><li onClick="chooseItem(this,false,"");return false;"><a thevalue="15" title="半月内" href="javascript:void(0);">半月内</a></li><li onClick="chooseItem(this,false,"");return false;"><a thevalue="30" title="一个月内" href="javascript:void(0);">一个月内</a></li><li onClick="chooseItem(this,false,"");return false;"><a thevalue="60" title="二个月内" href="javascript:void(0);">二个月内</a></li><li onClick="chooseItem(this,false,"");return false;" class="cu"><a thevalue="90" title="三个月内" href="javascript:void(0);">三个月内</a></li><li onClick="chooseItem(this,false,"");return false;"><a thevalue="183" title="半年内" href="javascript:void(0);">半年内</a></li><li onClick="chooseItem(this,false,"");return false;"><a thevalue="366" title="一年内" href="javascript:void(0);">一年内</a></li></ul></span></span>
</div>
</div>
<div class="team payTeam">
<div class="teamL">月薪范围</div>
<div class="teamR">
<span class="verSelect"><input type="hidden" value="00" name="selSalary" id="selSalary"><span onClick="toggleItemLi(this)" class="verSelectBg"><span class="verSelectTxt" style="width:182px;">请选择</span></span><span class="verSelectCon" style="height:150px;overflow:auto;height:150px;overflow:auto;width:218px;overflow-y:scroll;height:120px"><ul><li onClick="chooseItem(this,false,jobSearch.sltSalaryOnChange);return false;" class="cu"><a thevalue="00" title="请选择" href="javascript:void(0);">请选择</a></li><li onClick="chooseItem(this,false,jobSearch.sltSalaryOnChange);return false;"><a thevalue="99" title="面议" href="javascript:void(0);">面议</a></li><li onClick="chooseItem(this,false,jobSearch.sltSalaryOnChange);return false;"><a thevalue="1" title="1500以下" href="javascript:void(0);">1500以下</a></li><li onClick="chooseItem(this,false,jobSearch.sltSalaryOnChange);return false;"><a thevalue="2" title="1501-2000" href="javascript:void(0);">1501-2000</a></li><li onClick="chooseItem(this,false,jobSearch.sltSalaryOnChange);return false;"><a thevalue="3" title="2001-3000" href="javascript:void(0);">2001-3000</a></li><li onClick="chooseItem(this,false,jobSearch.sltSalaryOnChange);return false;"><a thevalue="4" title="3001-4000" href="javascript:void(0);">3001-4000</a></li><li onClick="chooseItem(this,false,jobSearch.sltSalaryOnChange);return false;"><a thevalue="5" title="4001-5000" href="javascript:void(0);">4001-5000</a></li><li onClick="chooseItem(this,false,jobSearch.sltSalaryOnChange);return false;"><a thevalue="6" title="5001-6000" href="javascript:void(0);">5001-6000</a></li><li onClick="chooseItem(this,false,jobSearch.sltSalaryOnChange);return false;"><a thevalue="7" title="6001-8000" href="javascript:void(0);">6001-8000</a></li><li onClick="chooseItem(this,false,jobSearch.sltSalaryOnChange);return false;"><a thevalue="8" title="8001-10000" href="javascript:void(0);">8001-10000</a></li><li onClick="chooseItem(this,false,jobSearch.sltSalaryOnChange);return false;"><a thevalue="9" title="10001-15000" href="javascript:void(0);">10001-15000</a></li><li onClick="chooseItem(this,false,jobSearch.sltSalaryOnChange);return false;"><a thevalue="10" title="15000以上" href="javascript:void(0);">15000以上</a></li><li onClick="chooseItem(this,false,jobSearch.sltSalaryOnChange);return false;"><a thevalue="100" title="自定义" href="javascript:void(0);">自定义</a></li></ul></span></span>
<div style="display:none;" id="salaryContainer">
<span class="verText"><input type="text" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onKeyUp="jobSearch.inputNumOnly(this, event, value)" maxlength="7" style="width:45px;margin:0 0 0 10px;" class="inputText" name="txtSalaryMin" id="txtSalaryMin"></span>
<span class="verTxt">至</span>
<span class="verText"><input type="text" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onKeyUp="jobSearch.inputNumOnly(this, event, value)" maxlength="7" style="width:45px;margin:0 0 0 10px;" class="inputText" name="txtSalaryMax" id="txtSalaryMax"></span>
</div>
<span style="display:none;" class="verCheckbox">
<input type="checkbox" value="0" name="chkSalary2" id="chkSalary2" class="checkBox"><label for="chkSalary2">包含面议</label>
</span>
</div>
</div>
<div class="team">
<div class="teamL">性别要求</div>
<div class="teamR">
<span class="verSelect"><input type="hidden" value="0" name="radSex" id="radSex"><span onClick="toggleItemLi(this)" class="verSelectBg"><span class="verSelectTxt" style="width:182px;">请选择</span></span><span class="verSelectCon" style="height:150px;overflow:auto;width:218px;overflow-y:scroll;height:120px"><ul><li onClick="chooseItem(this,false,"");return false;" class="cu"><a thevalue="0" title="请选择" href="javascript:void(0);">请选择</a></li><li onClick="chooseItem(this,false,"");return false;"><a thevalue="99" title="无要求" href="javascript:void(0);">无要求</a></li><li onClick="chooseItem(this,false,"");return false;"><a thevalue="1" title="男" href="javascript:void(0);">男</a></li><li onClick="chooseItem(this,false,"");return false;"><a thevalue="2" title="女" href="javascript:void(0);">女</a></li></ul></span></span>
</div>
</div>
<div class="team expTeam">
<div class="teamL">工作经验</div>
<div class="teamR">
<span class="selBtn">
<a name="btnWorkyear" id="btnWorkyear" href="javascript:void(0);"><b>不限</b></a><em></em>
<input type="hidden" value="0" name="isCustom" id="isCustom">
</span>
</div>
</div>
<div style="height:33px;" class="team">
<div class="teamL">工作性质</div>
<div class="teamR">
<span class="verCheckbox">
<input type="checkbox" class="checkBox" checked="checked" name="jobType" id="jobType1" value="1"><label for="jobType1"><em>全职</em></label>
</span>
<span class="verCheckbox">
<input type="checkbox" class="checkBox" checked="checked" name="jobType" id="jobType2" value="2"><label for="jobType2"><em>兼职</em></label>
</span>
<span class="verCheckbox">
<input type="checkbox" class="checkBox" checked="checked" name="jobType" id="jobType3" value="3"><label for="jobType3"><em>实习</em></label>
</span>
</div>
</div>
<div class="clear"></div>
</div>
<div class="searchBtn"><a id="btnSearch" class="btn11" href="javascript:void(0);"><b class="L"></b><b class="R"></b>搜 索</a><a class="emptyLink" id="hlkClear" href="javascript:void(0);">清空搜索条件</a></div>
</div>
</div>
</div>
</form>
<script type="text/javascript" language="javascript">
var jobSearch = {
initialize: function()
{
$("#btnOkff").click(function(){
$(":input[name=btntest]").val();
alert($(":input[name='btntest[]']").val());
});
this._initControl();
},
_initControl: function()
{
// area控件弹出提示
$('#btnArea').click(function(event)
{
event.preventDefault();
}).bindArea({ max: 5, multi: true, inputName: 'area[]', selectTo: '', noLimit: true, onChanged: function(data)
{
var html = '', i = 0, len = data.length;
for (i; i < len; i++)
{
var d = data[i];
html += getAreaName(d) + '+';
}
if (html.length > 1)
{
html = html.substring(0, html.length - 1);
$('#btnArea').attr('title', html);
}
else
{
$('#btnArea').attr('title', '');
}
if (html.length > 10)
{
html = html.substring(0, 10) + '...';
}
if (html.length > 0)
{
html = '<b>' + html + '</b>';
$('#btnArea').html(html);
}
else
{
$('#btnArea').html('<b>不限</b>');
}
}
});
//行业
$('#btnIndustry').click(function(event)
{
event.preventDefault();
}).bindCalling({ max: 5, multi: true, inputName: 'calling[]', selectTo: '', noLimit: true, onChanged: function(data)
{
var html = '', i = 0, len = data.length;
for (i; i < len; i++)
{
var d = data[i];
html += getCallingName(d) + '+';
}
if (html.length > 1)
{
html = html.substring(0, html.length - 1);
$('#btnIndustry').attr('title', html);
}
else
{
$('#btnIndustry').attr('title', '');
}
if (html.length > 10)
{
html = html.substring(0, 10) + '...';
}
if (html.length > 0)
{
html = '<b>' + html + '</b>';
$('#btnIndustry').html(html);
}
else
{
$('#btnIndustry').html('<b>不限</b>');
}
}
});
//职位类别
$('#btnFuntype').click(function(event)
{
event.preventDefault();
})
.bindJobsort({ max: 5, multi: true, inputName: 'jobsort[]', selectTo: '', noLimit: true, onChanged: function(data)
{
alert(data);
var html = '', i = 0, len = data.length;
for (i; i < len; i++)
{
var d = data[i];
html += getJobsortName(d) + '+';
}
if (html.length > 1)
{
html = html.substring(0, html.length - 1);
$('#btnFuntype').attr('title', html);
}
else
{
$('#btnFuntype').attr('title', '');
}
if (html.length > 10)
{
html = html.substring(0, 10) + '...';
}
if (html.length > 0)
{
html = '<b>' + html + '</b>';
$('#btnFuntype').html(html);
}
else
{
$('#btnFuntype').html('<b>不限</b>');
}
}
});
//公司性质
$('#btnProperty').bindComProperty({ max: 5, multi: true, inputName: 'property[]', selectTo: '', noLimit: true, onChanged: function(data)
{
var html = '';
for (var i in data)
{
html += getComPropertyName(data[i]) + '+';
}
if (html.length > 1)
{
html = html.substring(0, html.length - 1);
$('#btnProperty').attr('title', html);
}
else
{
$('#btnProperty').attr('title', '');
}
if (html.length > 10)
{
html = html.substring(0, 10) + '...';
}
if (html.length > 0)
{
html = '<b>' + html + '</b>';
$('#btnProperty').html(html);
}
else
{
$('#btnProperty').html('<b>不限</b>');
}
}
});
//公司规模
$('#btnCompanySize').bindComSize({ max: 3, multi: true, inputName: 'comSize[]', selectTo: '', noLimit: true, onChanged: function(data)
{
var html = '';
for (var i in data)
{
html += getComSizeName(data[i]) + '+';
}
if (html.length > 1)
{
html = html.substring(0, html.length - 1);
$('#btnCompanySize').attr('title', html);
}
else
{
$('#btnCompanySize').attr('title', '');
}
if (html.length > 10)
{
html = html.substring(0, 10) + '...';
}
if (html.length > 0)
{
html = '<b>' + html + '</b>';
$('#btnCompanySize').html(html);
}
else
{
$('#btnCompanySize').html('<b>不限</b>');
}
}
});
//学历
$('#btnDegree').bindDegree({ max: 3, multi: true, inputName: 'degree[]', selectTo: '', noLimit: true, onChanged: function(data)
{
var html = '';
for (var i in data)
{
html += getDegreeName(data[i]) + '+';
}
if (html.length > 1)
{
html = html.substring(0, html.length - 1);
$('#btnDegree').attr('title', html);
}
else
{
$('#btnDegree').attr('title', '');
}
if (html.length > 10)
{
html = html.substring(0, 10) + '...';
}
if (html.length > 0)
{
html = '<b>' + html + '</b>';
$('#btnDegree').html(html);
}
else
{
$('#btnDegree').html('<b>不限</b>');
}
}
});
//工作经验
$('#btnWorkyear').bindWorkyear({ max: 5, multi: true, inputName: 'workyear[]', selectTo: '', noLimit: true, isCustom: $('#isCustom'), onChanged: function(data)
{
var html = '';
for (var i in data)
{
if ($('#isCustom').val() == 1)
{
if (data[i] == '')
{
html += '不限-';
}
else
{
if (data[i] == '11')
{
html += "10年以上-";
}
else
{
html += data[i] + "年-";
}
}
}
else
{
html += getWorkyearName(data[i]) + '+';
}
}
if (html.length > 1)
{
html = html.substring(0, html.length - 1);
$('#btnWorkyear').attr('title', html);
}
else
{
$('#btnWorkyear').attr('title', '');
}
if (html.length > 10)
{
html = html.substring(0, 10) + '...';
}
if (html.length > 0)
{
html = '<b>' + html + '</b>';
$('#btnWorkyear').html(html);
}
else
{
$('#btnWorkyear').html('<b>不限</b>');
}
}
});
$('#btnSearch').click(function()
{
setTimeout(function() { $('#formJobSearch').submit(); }, 0);
return;
});
//保存为搜索器
$('#btnSaveJobSeeker').click(function()
{
var v = $('input[name=jobsort]').val();
var keyword = $('#txtKeyWords').val().trim();
var watermark = $('#txtKeyWords').attr('watermark');
if ((v == undefined || v == '') && (keyword == '' || keyword == watermark))
{
$.anchorMsg('职位类别、关键词至少选择一项!', { icon: 'warning' });
return;
}
var isLogin = checkPersonLogin('saveSeeker');
if (isLogin)
{
jobSearch.saveSeeker();
}
return false;
});
$('#btnEmailBook').click(function()
{
var v = $('input[name=jobsort]').val();
var keyword = $('#txtKeyWords').val().trim();
var watermark = $('#txtKeyWords').attr('watermark');
if ((v == undefined || v == '') && (keyword == '' || keyword == watermark))
{
$.anchorMsg('职位类别、关键词至少选择一项!', { icon: 'warning' });
return;
}
jobSearch.emailBook();
return false;
});
// 清空搜索条件
$('#hlkClear').click(function()
{
jobSearch.clearConditions();
});
},
saveSeeker: function()//保存职位搜索器
{
$.getJSON('/DragonVerPerson/JobSeekerSave.aspx?operate=IsCanAddJobSeeker', function(json)
{
if (json && !json.success)
{
$.message(json.msg, { title: '操作失败', icon: 'fail' });
return;
}
$.showModal('/DragonVerPerson/JobSeekerSave.aspx?operate=Add&formID=formJobSearch', { title: '添加职位搜索器' });
});
},
emailBook: function()//保存邮件订阅
{
$.showModal('/EmailBook.aspx?operate=EmailBook&formID=formJobSearch', { title: '保存邮件订阅' });
},
sltSalaryOnChange: function(v)
{
if (v == 00 || v == 99)
{
$('#txtSalaryMin').val("");
$('#txtSalaryMax').val("");
$('#salaryContainer').hide();
}
else if (v == 100)
{
$('#txtSalaryMin').val("");
$('#txtSalaryMax').val("");
$('#salaryContainer').show();
}
else
{
$.getJSON('/MapSearch.aspx', { 'operate': 'GetSalaryMin', 'salaryID': v }, function(json)
{
if (json && json.error)
{
$.anchorMsg('参数错误请重新选择!', { icon: 'warning' });
return;
}
$('#txtSalaryMin').val(json.salaryLower);
$('#txtSalaryMax').val(json.salaryMax);
$('#salaryContainer').hide();
});
}
},
inputNumOnly: function(o, e, v)
{
if (e.keyCode < 37 || e.keyCode > 40)
{
$(o).val(v.replace(/[^\d]/g, ''));
}
},
clearConditions: function()//清空所选的搜索条件
{
var waterMark = $('#txtKeyWords').attr('watermark');
if ($('#txtKeyWords').val() != waterMark)
{
$('#txtKeyWords').val('');
}
$('#chooseStation').attr('checked', true);
$('#btnIndustry').callingValues([]);
$('#btnArea').areaValues([]);
$('#btnFuntype').jobsortValues([]);
$('#btnProperty').comPropertyValues([]);
$('input[name=jobType]').attr('checked', true);
$('#btnWorkyear').workyearValues([]);
$('#isCustom').val(0);
$('#btnDegree').degreeValues([]);
$('#radSex').closest('span.verSelect').find('a[thevalue=0]').closest('li').click();
$('#selIssueTime').closest('span.verSelect').find('a[thevalue=90]').closest('li').click();
$('#selSalary').closest('span.verSelect').find('a[thevalue=00]').closest('li').click();
$('#txtSalaryMin').val('');
$('#txtSalaryMax').val('');
$('#btnCompanySize').comSizeValues([]);
$.anchor('清空搜索条件成功', { timeout: 1 });
}
}
jobSearch.initialize();
</script>
</body>
</html>