狮身人面像配置文件
sql_query = SELECT item_id, item_title, item_time, cat_id, region_id, region_parent, region1, region2, region3, metro_id, group_id, doc_words, FROM articles;
sql_attr_uint = cat_id
sql_attr_uint = region_id
sql_attr_uint = region_parent
sql_attr_uint = region1
sql_attr_uint = region2
sql_attr_uint = region3
sql_attr_uint = metro_id
sql_attr_uint = group_id
sql_attr_timestamp = item_time
sql_query_info = SELECT * FROM articles WHERE item_id=$id
php狮身人面像客户端
$cl->SetMatchMode( SPH_SORT_EXTENDED );
// User choses either full text search for title or doc_words column
if ($user_column_selected == "titles")
{
$user_selected_table = "@item_title";
}
elseif ($user_column_selected == "@doc_words")
{
$user_selected_table = "@doc_words";
}
// User chose to filter by metro_id
$metro_array = explode(",", $selected_market_type);
$cl->SetFilter('metro_id', $metro_array);
// User chose to filter by category
$cat_array = explode(",", $selected_category);
$cl->SetFilter('cat_id', $cat_array);
// User chose to filter by a range of region_id
if ($user_region_range == "1")
{
$cl->SetFilterRange('region_id', 100, 152, TRUE);
}
else
{
/**** USER SELECTED A SPECIFIC REGION ****/
$region_array = explode(",", $selected_region);
$cl->SetFilter('region_id', $region_array);
}
// User chose to sort by time rather than relevance
if ($user_relevance == "1")
{
// by item time
$cl->SetSortMode(SPH_SORT_ATTR_DESC, 'item_time');
}
// User chose to filter by time range
if ($user_date_filter == "1")
{
$cl->SetFilterRange('item_time',$unix_date_from, $unix_date_to,$exclude=false);
}
// User choses to group results by group_id
if ($user_group == "1")
{
$cl->SetGroupBy ( 'group_id', SPH_GROUPBY_ATTR, '@group desc' );
}
$sphinx_result = $cl->Query($user_selected_table." ".$user_text_query, my_sphinx_index );
使用我在上面创建的内容,用户可以对 item_title 或 doc_words 执行全文搜索,可以通过一个或多个 sql_attr_uint 列缩小结果,这些列可以按 item_time 排序并按 group_id 分组。
我目前可以通过我的任何 sql_attr_uint 区域列设置过滤器,如上所示,但我需要的是这些区域列的布尔或。
我想在不丢失上述任何功能的情况下这样做,同时为列 region_id、region_parent、region1、region2、region3 添加某种“setFilter OR”。
我已经阅读了文档中带有 mysql CONCAT 示例的 setSelect 和 setFilter,但在将其应用于此类配置时对我没有任何意义。处理它的最佳方法是什么?