added : elastic search plugin added , now search Elastic :)
This commit is contained in:
parent
b5a5c2572d
commit
b6dfa272a2
11 changed files with 2930 additions and 0 deletions
279
upload/plugins/cb_elastic_search/ElasticScript.php
Executable file
279
upload/plugins/cb_elastic_search/ElasticScript.php
Executable file
|
@ -0,0 +1,279 @@
|
|||
<?php
|
||||
|
||||
require 'includes/config.inc.php';
|
||||
|
||||
//require_once("includes/classes/elasticSearch.php");
|
||||
|
||||
|
||||
$request = $_REQUEST;
|
||||
$mode = $request["mode"];
|
||||
$type = $request["type"];
|
||||
if (!isset($request["method"])){
|
||||
$method = "get";
|
||||
}else{
|
||||
$method = $request["method"];
|
||||
}
|
||||
#$method = $request['method'] ? "GET" : "GET";
|
||||
$offset = 0;
|
||||
$count = 0;
|
||||
|
||||
if (isset($request["offset"])){
|
||||
$offset = $request["offset"];
|
||||
}
|
||||
if (isset($request["count"])){
|
||||
$count = $request["count"];
|
||||
}
|
||||
|
||||
|
||||
$response = array();
|
||||
$response["data"] = null;
|
||||
$results = array();
|
||||
try{
|
||||
|
||||
if (!$mode){
|
||||
throw new Exception("Please provide mode to map or index");
|
||||
}
|
||||
|
||||
|
||||
switch ($mode) {
|
||||
default:
|
||||
case 'videos':{
|
||||
|
||||
$index = $mode;
|
||||
$es = new ElasticSearch($index);
|
||||
|
||||
if ($type == 'map'){
|
||||
|
||||
|
||||
//mapping the database with ES server for videos
|
||||
$mappingData = $es->videoMappingData;
|
||||
//Finally Calling the Function
|
||||
$extras["method"] = $method;
|
||||
$response["data"] = $es->EsMap($mappingData,$extras);
|
||||
if ($response["data"]["curl_error_no"]){
|
||||
exit(json_encode(array("err"=>$response["data"]["curl_error"],"data"=>$response)));
|
||||
}else{
|
||||
exit(json_encode(array("msg"=>"success","data"=>$response)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}elseif ($type == 'index'){
|
||||
|
||||
$videoRequest = array();
|
||||
|
||||
//applying dynamic limit
|
||||
if ($count){
|
||||
$videoRequest["limit"] = $offset.','.$count;
|
||||
}
|
||||
|
||||
// get a specific video
|
||||
if ( isset($request["id"]) ){
|
||||
$videoRequest["videoid"] = $request["id"];
|
||||
}
|
||||
|
||||
//Fetching Videos to process
|
||||
$videos = $cbvid->get_videos($videoRequest);
|
||||
$extras["method"] = $method;
|
||||
|
||||
if ($videos){
|
||||
|
||||
foreach ($videos as $key => $video) {
|
||||
|
||||
$formattedVideo = $es->FormatVideo($video);
|
||||
$extras["id"] = $video["videoid"];
|
||||
$response["data"] = $es->EsIndex($formattedVideo,$extras);
|
||||
|
||||
//checking for Curl Error
|
||||
if ($response["data"]["curl_error_no"]){
|
||||
throw new Exception($response["data"]["curl_error"]);
|
||||
|
||||
}
|
||||
#pre($response,1);
|
||||
//checking for bad request or error
|
||||
/*if ($response["data"]["code"] == '400' ){
|
||||
throw new Exception($response["data"]["result"]);
|
||||
}*/
|
||||
|
||||
$results[] = $response["data"];
|
||||
}
|
||||
}else{
|
||||
throw new Exception("No Video Found for this request");
|
||||
}
|
||||
|
||||
//Creating Response
|
||||
exit(json_encode(array("msg"=>"success","data"=>$results)));
|
||||
|
||||
}else{
|
||||
throw new Exception("Invalid Request, please select proper type");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case 'users':{
|
||||
|
||||
|
||||
$index = $mode;
|
||||
$es = new ElasticSearch($index);
|
||||
|
||||
if ($type == 'map'){
|
||||
|
||||
|
||||
//mapping the database with ES server for videos
|
||||
$mappingData = $es->userMappingData;
|
||||
//Finally Calling the Function
|
||||
$extras["method"] = $method;
|
||||
$response["data"] = $es->EsMap($mappingData,$extras);
|
||||
if ($response["data"]["curl_error_no"]){
|
||||
exit(json_encode(array("err"=>$response["data"]["curl_error"],"data"=>$response)));
|
||||
}else{
|
||||
exit(json_encode(array("msg"=>"success","data"=>$response)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}elseif ($type == 'index'){
|
||||
|
||||
$userRequest = array();
|
||||
|
||||
//applying dynamic limit
|
||||
if ($count){
|
||||
$userRequest["limit"] = $offset.','.$count;
|
||||
}
|
||||
|
||||
// get a specific user
|
||||
if ( isset($request["id"]) ){
|
||||
$userRequest["userid"] = $request["id"];
|
||||
}
|
||||
|
||||
//Fetching users to process
|
||||
$users = $userquery->get_users($userRequest);
|
||||
$extras["method"] = $method;
|
||||
|
||||
if ($users){
|
||||
foreach ($users as $key => $user) {
|
||||
$formatteduser = $es->FormatUser($user);
|
||||
$extras["id"] = $user["userid"];
|
||||
$response["data"] = $es->EsIndex($formatteduser,$extras);
|
||||
|
||||
//checking for Curl Error
|
||||
if ($response["data"]["curl_error_no"]){
|
||||
throw new Exception($response["data"]["curl_error"]);
|
||||
|
||||
}
|
||||
#pre($response,1);
|
||||
//checking for bad request or error
|
||||
/*if ($response["data"]["code"] == '400' ){
|
||||
throw new Exception($response["data"]["result"]);
|
||||
}*/
|
||||
|
||||
$results[] = $response["data"];
|
||||
}
|
||||
}else{
|
||||
throw new Exception("No Video Found for this request");
|
||||
}
|
||||
|
||||
//Creating Response
|
||||
exit(json_encode(array("msg"=>"success","data"=>$results)));
|
||||
|
||||
}else{
|
||||
throw new Exception("Invalid Request, please select proper type");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case 'collections':
|
||||
case 'groups':{
|
||||
|
||||
|
||||
$index = $mode;
|
||||
$es = new ElasticSearch($index);
|
||||
|
||||
if ($type == 'map'){
|
||||
|
||||
//mapping the database with ES server for videos
|
||||
if ($index == 'groups'){
|
||||
$mappingData = $es->groupMappingData;
|
||||
}else{
|
||||
$mappingData = $es->collectionMappingData;
|
||||
}
|
||||
//Finally Calling the Function
|
||||
$extras["method"] = $method;
|
||||
$response["data"] = $es->EsMap($mappingData,$extras);
|
||||
if ($response["data"]["curl_error_no"]){
|
||||
exit(json_encode(array("err"=>$response["data"]["curl_error"],"data"=>$response)));
|
||||
}else{
|
||||
exit(json_encode(array("msg"=>"success","data"=>$response)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}elseif ($type == 'index'){
|
||||
|
||||
$groupRequest = array();
|
||||
|
||||
//applying dynamic limit
|
||||
if ($count){
|
||||
$groupRequest["limit"] = $offset.','.$count;
|
||||
}
|
||||
// get a specific group
|
||||
if ( isset($request["id"]) ){
|
||||
$groupRequest["group_id"] = $request["id"];
|
||||
}
|
||||
|
||||
if ($index == 'collections'){
|
||||
$groupRequest["is_collection"] = "yes";
|
||||
}else{
|
||||
$groupRequest["is_collection"] = "no";
|
||||
}
|
||||
|
||||
//Fetching groups to process
|
||||
$groups = $cbgroup->get_groups($groupRequest);
|
||||
$extras["method"] = $method;
|
||||
|
||||
if ($groups){
|
||||
foreach ($groups as $key => $group) {
|
||||
$formattedgroup = $es->FormatGroupCollection($group);
|
||||
$extras["id"] = $group["group_id"];
|
||||
$response["data"] = $es->EsIndex($formattedgroup,$extras);
|
||||
#pr($response,1);
|
||||
//checking for Curl Error
|
||||
if ($response["data"]["curl_error_no"]){
|
||||
throw new Exception($response["data"]["curl_error"]);
|
||||
|
||||
}
|
||||
#pre($response,1);
|
||||
//checking for bad request or error
|
||||
/*if ($response["data"]["code"] == '400' ){
|
||||
throw new Exception($response["data"]["result"]);
|
||||
}*/
|
||||
|
||||
$results[] = $response["data"];
|
||||
}
|
||||
}else{
|
||||
throw new Exception("No Video Found for this request");
|
||||
}
|
||||
|
||||
//Creating Response
|
||||
exit(json_encode(array("msg"=>"success","data"=>$results)));
|
||||
|
||||
}else{
|
||||
throw new Exception("Invalid Request, please select proper type");
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}catch(Exception $e){
|
||||
exit(json_encode(array("err"=>$e->getMessage(),"data"=>$response)));
|
||||
}
|
||||
|
||||
?>
|
126
upload/plugins/cb_elastic_search/admin/index_data.html
Executable file
126
upload/plugins/cb_elastic_search/admin/index_data.html
Executable file
|
@ -0,0 +1,126 @@
|
|||
|
||||
|
||||
|
||||
<span class="page_title">ElasticSearch Indexer</span>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12 mrgnt15">
|
||||
<span class="mandtory"><h1></h1></span>
|
||||
</div>
|
||||
<div class="col-lg-11">
|
||||
<div class="row">
|
||||
<form id="index" method="post">
|
||||
<!-- <input type="hidden" name="type" value="index"> -->
|
||||
<!-- <input type="hidden" name="method" value="put"> -->
|
||||
<div class="col-md-2">
|
||||
<label for="offset">Request</label>
|
||||
<select class="form-control" name="method">
|
||||
<option value="put" selected>PUT</option>
|
||||
<option value="get">GET</option>
|
||||
<option value="delete">DELETE</option>
|
||||
<option value="post">POST</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label for="offset">Type</label>
|
||||
<select class="form-control" name="type">
|
||||
<option value="map">MAP</option>
|
||||
<option value="index" selected>INDEX</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label for="offset">Offset</label>
|
||||
<input type="text" name="offset" class="form-control" value="0">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label for="count">Count</label>
|
||||
<input type="text" name="count" class="form-control" value="1">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label for="count">Id</label>
|
||||
<input type="text" name="id" class="form-control" value="0">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label for="offset">Mode</label>
|
||||
<select class="form-control" name="mode">
|
||||
<option value="videos" selected>Videos</option>
|
||||
<option value="users">Users</option>
|
||||
<option value="photos">Photos</option>
|
||||
<!-- <option value="collections">Collections</option> -->
|
||||
</select>
|
||||
|
||||
</div>
|
||||
<div class="col-md-2" style="margin-top: 25px;">
|
||||
<input type="submit" name="submit" id="submit" class="btn btn-md btn-success" value="Index">
|
||||
</div>
|
||||
<!-- <div class="col-md-4" style="margin-top: 25px;">
|
||||
<span class="alert alert-info load-msg hide">
|
||||
This may take few minutes....
|
||||
</span>
|
||||
</div> -->
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-top: 25px;margin-left: 15px;" >
|
||||
<div class="col-lg-12 results" style="background: #f8f8f8;border: 1px solid #d4d4d4"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var ElasticScript = '{$cb_es_ajax_url}';
|
||||
$(document).ready(function(){
|
||||
$("#index").on("submit",function(e){
|
||||
e.preventDefault();
|
||||
|
||||
var formData_ = new FormData(this);
|
||||
|
||||
$.ajax({
|
||||
url: ElasticScript,
|
||||
data: formData_,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
type: 'POST',
|
||||
|
||||
beforeSend : function(data){
|
||||
$(".load-msg").removeClass("hide");
|
||||
$("#submit").attr("disabled",true);
|
||||
$("#submit").val("..Indexing");
|
||||
$(".results").html("");
|
||||
},
|
||||
success: function(data){
|
||||
|
||||
var results = $.parseJSON(data);
|
||||
var dataResults = results.data;
|
||||
console.log(dataResults);
|
||||
var html = "<ul style='margin-top:20px'>";
|
||||
if (typeof dataResults.length !== 'undefined'){
|
||||
for (var i = 0; i < dataResults.length ; i ++){
|
||||
if (dataResults[i].code == '400'){
|
||||
html += "<li style='color:red'>";
|
||||
}else{
|
||||
html += "<li style='color:green'>";
|
||||
}
|
||||
html += "<strong>Status Code : </strong>"+dataResults[i].code
|
||||
html += " <strong>Result : </strong>"+dataResults[i].result
|
||||
html += "</li>"
|
||||
}
|
||||
}else{
|
||||
html += dataResults.data.result;
|
||||
}
|
||||
|
||||
html += "</ul>";
|
||||
|
||||
$(".results").html(html);
|
||||
|
||||
$(".load-msg").addClass("hide");
|
||||
$("#submit").attr("disabled",false);
|
||||
$("#submit").val("Index");
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
</script>
|
20
upload/plugins/cb_elastic_search/admin/index_data.php
Executable file
20
upload/plugins/cb_elastic_search/admin/index_data.php
Executable file
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
/*
|
||||
***************************************************************
|
||||
| Copyright (c) 2007-2010 Clip-Bucket.com. All rights reserved.
|
||||
| @ Author : ArslanHassan
|
||||
| @ Software : ClipBucket , © PHPBucket.com
|
||||
****************************************************************
|
||||
*/
|
||||
|
||||
if(!defined('IN_CLIPBUCKET'))
|
||||
exit('Invalid access');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$template = 'index_data.html';
|
||||
template_files($template,CB_ES_ADMIN_DIR);
|
||||
|
||||
?>
|
1130
upload/plugins/cb_elastic_search/elasticSearch.php
Executable file
1130
upload/plugins/cb_elastic_search/elasticSearch.php
Executable file
File diff suppressed because it is too large
Load diff
54
upload/plugins/cb_elastic_search/elastic_search.php
Executable file
54
upload/plugins/cb_elastic_search/elastic_search.php
Executable file
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
Plugin Name: Clipbucket Elastic Search Module
|
||||
Description: This Plugins provides a new experience for efficient search
|
||||
Author: Fahad Abbas
|
||||
Author Website: http://clip-bucket.com/
|
||||
Version: 2.0
|
||||
ClipBucket Version: 4.2
|
||||
*/
|
||||
|
||||
|
||||
|
||||
define('CB_ES', this_plugin( __FILE__ ) );
|
||||
assign('cb_es',CB_ES_MANAGER);
|
||||
|
||||
define('CB_ES','installed');
|
||||
assign('cb_es',CB_ES);
|
||||
/* PATHS */
|
||||
define( 'CB_ES_DIR', PLUG_DIR.'/'.CB_ES);
|
||||
define( 'CB_ES_URL', PLUG_URL.'/'.CB_ES );
|
||||
|
||||
define( 'CB_ES_ADMIN_DIR', CB_ES_DIR.'/admin');
|
||||
define( 'CB_ES_ADMIN_URL', CB_ES_URL.'/admin');
|
||||
|
||||
assign('cb_es_dir',CB_ES_DIR);
|
||||
assign('cb_es_url',CB_ES_URL);
|
||||
|
||||
assign('cb_es_admin_dir',CB_ES_ADMIN_DIR);
|
||||
assign('cb_es_admin_url',CB_ES_ADMIN_URL);
|
||||
|
||||
assign('cb_es_ajax_url',CB_ES_URL.'/es_ajax.php');
|
||||
|
||||
define('CB_ES_INSTALLED', 'yes' );
|
||||
assign('cb_es_installed',CB_ES_INSTALLED);
|
||||
|
||||
|
||||
|
||||
$Cbucket->links['search_result'] = array('module.php','module.php');
|
||||
|
||||
function elastic_mode_search() {
|
||||
echo '<input type="hidden" name="s" value="elastic">';
|
||||
echo '<input type="hidden" name="p" value="search">';
|
||||
}
|
||||
|
||||
|
||||
//Elastic Search Class
|
||||
include "elasticSearch.php";
|
||||
|
||||
register_anchor_function("elastic_mode_search","elastic_mode_search");
|
||||
|
||||
register_module('elastic_search',CB_ES_DIR.'/search.php');
|
||||
|
||||
add_admin_menu("Elastic Search","ES Indexer",'index_data.php',CB_ES.'/admin');
|
360
upload/plugins/cb_elastic_search/es_ajax.php
Executable file
360
upload/plugins/cb_elastic_search/es_ajax.php
Executable file
|
@ -0,0 +1,360 @@
|
|||
<?php
|
||||
|
||||
include("../../includes/config.inc.php");
|
||||
|
||||
//require_once("includes/classes/elasticSearch.php");
|
||||
|
||||
#ini_set('display_errors', -1);
|
||||
#error_reporting(E_ALL);
|
||||
|
||||
$request = $_REQUEST;
|
||||
$mode = $request["mode"];
|
||||
$type = $request["type"];
|
||||
if (!isset($request["method"])){
|
||||
$method = "get";
|
||||
}else{
|
||||
$method = $request["method"];
|
||||
}
|
||||
#$method = $request['method'] ? "GET" : "GET";
|
||||
$offset = 0;
|
||||
$count = 0;
|
||||
|
||||
if (isset($request["offset"])){
|
||||
$offset = $request["offset"];
|
||||
}
|
||||
if (isset($request["count"])){
|
||||
$count = $request["count"];
|
||||
}
|
||||
|
||||
|
||||
$response = array();
|
||||
$response["data"] = null;
|
||||
$results = array();
|
||||
try{
|
||||
|
||||
if (!$mode){
|
||||
throw new Exception("Please provide mode to map or index");
|
||||
}
|
||||
|
||||
|
||||
switch ($mode) {
|
||||
default:
|
||||
case 'videos':{
|
||||
|
||||
$index = $mode;
|
||||
$es = new ElasticSearch($index);
|
||||
|
||||
if ($type == 'map'){
|
||||
|
||||
|
||||
//mapping the database with ES server for videos
|
||||
$mappingData = $es->videoMappingData;
|
||||
//Finally Calling the Function
|
||||
$extras["method"] = $method;
|
||||
$response["data"] = $es->EsMap($mappingData,$extras);
|
||||
if ($response["data"]["curl_error_no"]){
|
||||
exit(json_encode(array("err"=>$response["data"]["curl_error"],"data"=>$response)));
|
||||
}else{
|
||||
exit(json_encode(array("msg"=>"success","data"=>$response)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}elseif ($type == 'index'){
|
||||
|
||||
$videoRequest = array();
|
||||
|
||||
//applying dynamic limit
|
||||
if ($count){
|
||||
$videoRequest["limit"] = $offset.','.$count;
|
||||
}
|
||||
|
||||
// get a specific video
|
||||
if ( isset($request["id"]) ){
|
||||
$videoRequest["videoid"] = $request["id"];
|
||||
}
|
||||
|
||||
//Fetching Videos to process
|
||||
$videos = $cbvid->get_videos($videoRequest);
|
||||
$extras["method"] = $method;
|
||||
|
||||
if ($videos){
|
||||
|
||||
foreach ($videos as $key => $video) {
|
||||
|
||||
$formattedVideo = $es->FormatVideo($video);
|
||||
$extras["id"] = $video["videoid"];
|
||||
$response["data"] = $es->EsIndex($formattedVideo,$extras);
|
||||
|
||||
//checking for Curl Error
|
||||
if ($response["data"]["curl_error_no"]){
|
||||
throw new Exception($response["data"]["curl_error"]);
|
||||
|
||||
}
|
||||
#pre($response,1);
|
||||
//checking for bad request or error
|
||||
/*if ($response["data"]["code"] == '400' ){
|
||||
throw new Exception($response["data"]["result"]);
|
||||
}*/
|
||||
|
||||
$results[] = $response["data"];
|
||||
}
|
||||
}else{
|
||||
throw new Exception("No Video Found for this request");
|
||||
}
|
||||
|
||||
//Creating Response
|
||||
exit(json_encode(array("msg"=>"success","data"=>$results)));
|
||||
|
||||
}else{
|
||||
throw new Exception("Invalid Request, please select proper type");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'photos':{
|
||||
|
||||
$index = $mode;
|
||||
$es = new ElasticSearch($index);
|
||||
|
||||
if ($type == 'map'){
|
||||
|
||||
|
||||
//mapping the database with ES server for videos
|
||||
$mappingData = $es->photoMappingData;
|
||||
//Finally Calling the Function
|
||||
$extras["method"] = $method;
|
||||
$response["data"] = $es->EsMap($mappingData,$extras);
|
||||
if ($response["data"]["curl_error_no"]){
|
||||
exit(json_encode(array("err"=>$response["data"]["curl_error"],"data"=>$response)));
|
||||
}else{
|
||||
exit(json_encode(array("msg"=>"success","data"=>$response)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}elseif ($type == 'index'){
|
||||
|
||||
$photoRequest = array();
|
||||
|
||||
//applying dynamic limit
|
||||
if ($count){
|
||||
$photoRequest["limit"] = $offset.','.$count;
|
||||
}
|
||||
|
||||
// get a specific photo
|
||||
if ( isset($request["id"]) ){
|
||||
$photoRequest["photoid"] = $request["id"];
|
||||
}
|
||||
|
||||
//Fetching photos to process
|
||||
$photos = $cbphoto->get_photos($photoRequest);
|
||||
|
||||
$extras["method"] = $method;
|
||||
|
||||
if ($photos){
|
||||
|
||||
foreach ($photos as $key => $photo) {
|
||||
|
||||
$formattedPhoto = $es->FormatPhoto($photo);
|
||||
$extras["id"] = $photo["photo_id"];
|
||||
$response["data"] = $es->EsIndex($formattedPhoto,$extras);
|
||||
|
||||
//checking for Curl Error
|
||||
if ($response["data"]["curl_error_no"]){
|
||||
throw new Exception($response["data"]["curl_error"]);
|
||||
|
||||
}
|
||||
#pre($response,1);
|
||||
//checking for bad request or error
|
||||
/*if ($response["data"]["code"] == '400' ){
|
||||
throw new Exception($response["data"]["result"]);
|
||||
}*/
|
||||
|
||||
$results[] = $response["data"];
|
||||
}
|
||||
}else{
|
||||
throw new Exception("No photo Found for this request");
|
||||
}
|
||||
|
||||
//Creating Response
|
||||
exit(json_encode(array("msg"=>"success","data"=>$results)));
|
||||
|
||||
}else{
|
||||
throw new Exception("Invalid Request, please select proper type");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'users':{
|
||||
|
||||
|
||||
$index = $mode;
|
||||
$es = new ElasticSearch($index);
|
||||
|
||||
if ($type == 'map'){
|
||||
|
||||
|
||||
//mapping the database with ES server for videos
|
||||
$mappingData = $es->userMappingData;
|
||||
//Finally Calling the Function
|
||||
$extras["method"] = $method;
|
||||
$response["data"] = $es->EsMap($mappingData,$extras);
|
||||
if ($response["data"]["curl_error_no"]){
|
||||
exit(json_encode(array("err"=>$response["data"]["curl_error"],"data"=>$response)));
|
||||
}else{
|
||||
exit(json_encode(array("msg"=>"success","data"=>$response)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}elseif ($type == 'index'){
|
||||
|
||||
$userRequest = array();
|
||||
|
||||
//applying dynamic limit
|
||||
if ($count){
|
||||
$userRequest["limit"] = $offset.','.$count;
|
||||
}
|
||||
|
||||
// get a specific user
|
||||
if ( isset($request["id"]) ){
|
||||
$userRequest["userid"] = $request["id"];
|
||||
}
|
||||
|
||||
//Fetching users to process
|
||||
$users = $userquery->get_users($userRequest);
|
||||
$extras["method"] = $method;
|
||||
|
||||
if ($users){
|
||||
foreach ($users as $key => $user) {
|
||||
$formatteduser = $es->FormatUser($user);
|
||||
$extras["id"] = $user["userid"];
|
||||
$response["data"] = $es->EsIndex($formatteduser,$extras);
|
||||
|
||||
//checking for Curl Error
|
||||
if ($response["data"]["curl_error_no"]){
|
||||
throw new Exception($response["data"]["curl_error"]);
|
||||
|
||||
}
|
||||
#pre($response,1);
|
||||
//checking for bad request or error
|
||||
/*if ($response["data"]["code"] == '400' ){
|
||||
throw new Exception($response["data"]["result"]);
|
||||
}*/
|
||||
|
||||
$results[] = $response["data"];
|
||||
}
|
||||
}else{
|
||||
throw new Exception("No Video Found for this request");
|
||||
}
|
||||
|
||||
//Creating Response
|
||||
exit(json_encode(array("msg"=>"success","data"=>$results)));
|
||||
|
||||
}else{
|
||||
throw new Exception("Invalid Request, please select proper type");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case 'collections':
|
||||
case 'groups':{
|
||||
|
||||
|
||||
$index = $mode;
|
||||
$es = new ElasticSearch($index);
|
||||
|
||||
if ($type == 'map'){
|
||||
|
||||
//mapping the database with ES server for videos
|
||||
if ($index == 'groups'){
|
||||
$mappingData = $es->groupMappingData;
|
||||
}else{
|
||||
$mappingData = $es->collectionMappingData;
|
||||
}
|
||||
//Finally Calling the Function
|
||||
$extras["method"] = $method;
|
||||
$response["data"] = $es->EsMap($mappingData,$extras);
|
||||
if ($response["data"]["curl_error_no"]){
|
||||
exit(json_encode(array("err"=>$response["data"]["curl_error"],"data"=>$response)));
|
||||
}else{
|
||||
exit(json_encode(array("msg"=>"success","data"=>$response)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}elseif ($type == 'index'){
|
||||
|
||||
$groupRequest = array();
|
||||
|
||||
//applying dynamic limit
|
||||
if ($count){
|
||||
$groupRequest["limit"] = $offset.','.$count;
|
||||
}
|
||||
// get a specific group
|
||||
if ( isset($request["id"]) ){
|
||||
$groupRequest["group_id"] = $request["id"];
|
||||
}
|
||||
|
||||
if ($index == 'collections'){
|
||||
$groupRequest["is_collection"] = "yes";
|
||||
}else{
|
||||
$groupRequest["is_collection"] = "no";
|
||||
}
|
||||
|
||||
//Fetching groups to process
|
||||
$groups = $cbgroup->get_groups($groupRequest);
|
||||
$extras["method"] = $method;
|
||||
|
||||
if ($groups){
|
||||
foreach ($groups as $key => $group) {
|
||||
$formattedgroup = $es->FormatGroupCollection($group);
|
||||
$extras["id"] = $group["group_id"];
|
||||
$response["data"] = $es->EsIndex($formattedgroup,$extras);
|
||||
#pr($response,1);
|
||||
//checking for Curl Error
|
||||
if ($response["data"]["curl_error_no"]){
|
||||
throw new Exception($response["data"]["curl_error"]);
|
||||
|
||||
}
|
||||
#pre($response,1);
|
||||
//checking for bad request or error
|
||||
/*if ($response["data"]["code"] == '400' ){
|
||||
throw new Exception($response["data"]["result"]);
|
||||
}*/
|
||||
|
||||
$results[] = $response["data"];
|
||||
}
|
||||
}else{
|
||||
throw new Exception("No Video Found for this request");
|
||||
}
|
||||
|
||||
//Creating Response
|
||||
exit(json_encode(array("msg"=>"success","data"=>$results)));
|
||||
|
||||
}else{
|
||||
throw new Exception("Invalid Request, please select proper type");
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}catch(Exception $e){
|
||||
exit(json_encode(array("err"=>$e->getMessage(),"data"=>$response)));
|
||||
}
|
||||
|
||||
?>
|
7
upload/plugins/cb_elastic_search/install_elastic_search.php
Executable file
7
upload/plugins/cb_elastic_search/install_elastic_search.php
Executable file
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
|
||||
$db->Execute("INSERT INTO ".tbl('config')." (`configid`, `name`, `value`) VALUES
|
||||
(1, 'elastic_server_ip', 'localhost');");
|
||||
|
||||
?>
|
304
upload/plugins/cb_elastic_search/search.html
Executable file
304
upload/plugins/cb_elastic_search/search.html
Executable file
|
@ -0,0 +1,304 @@
|
|||
<div class="container clearfix" style="padding-top: 50px;">
|
||||
<div class="row cb-box">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="{if $mode == 'all'}active{/if}">
|
||||
<a href="?type=all&query={$smarty.get.query|form_val}&category={$smarty.get.category|form_val}&author={$smarty.get.author|form_val}&search_by={$smarty.get.search_by|form_val}&s=elastic&p=search" >
|
||||
All
|
||||
</a>
|
||||
</li>
|
||||
<li class="{if $mode == 'videos'}active{/if}" >
|
||||
<a href="?type=videos&query={$smarty.get.query|form_val}&category={$smarty.get.category|form_val}&author={$smarty.get.author|form_val}&search_by={$smarty.get.search_by|form_val}&s=elastic&p=search" >
|
||||
Videos
|
||||
</a>
|
||||
</li>
|
||||
<li class="{if $mode == 'photos'}active{/if}" >
|
||||
<a href="?type=photos&query={$smarty.get.query|form_val}&category={$smarty.get.category|form_val}&author={$smarty.get.author|form_val}&search_by={$smarty.get.search_by|form_val}&s=elastic&p=search">
|
||||
Photos
|
||||
</a>
|
||||
</li>
|
||||
<li class="{if $mode == 'channels'}active{/if}" >
|
||||
<a href="?type=channels&query={$smarty.get.query|form_val}&category={$smarty.get.category|form_val}&author={$smarty.get.author|form_val}&search_by={$smarty.get.search_by|form_val}&s=elastic&p=search" >
|
||||
Channels</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="row cb-box">
|
||||
<div class="col-lg-9 col-md-9 col-sm-8 col-xs-12">
|
||||
<div class="tab-content">
|
||||
<div role="tabpanel" class="tab-pane {if $mode == 'all'}active{/if}" id="all-tab">
|
||||
{if $videos}
|
||||
<div class="search-sec clearfix">
|
||||
<h4>
|
||||
Videos
|
||||
<span class="pull-right"><a href="{link name='videos'}">See All</a></span>
|
||||
</h4>
|
||||
<div class="all-search-holder clearfix">
|
||||
{foreach $videos as $video}
|
||||
{include file="$style_dir/blocks/video.html" display_type='normal'}
|
||||
{/foreach}
|
||||
</div>
|
||||
</div><!-- videos -->
|
||||
{/if}
|
||||
{if $photos}
|
||||
<div class="search-sec clearfix">
|
||||
<h4>
|
||||
Photos
|
||||
<span class="pull-right"><a href="{link name='photos'}">See All</a></span>
|
||||
</h4>
|
||||
<div class="all-search-holder clearfix">
|
||||
{foreach $photos as $photo}
|
||||
{include file="$style_dir/blocks/photo.html" }
|
||||
|
||||
{/foreach}
|
||||
</div>
|
||||
</div><!-- videos -->
|
||||
{/if}
|
||||
{if $users}
|
||||
<div class="search-sec clearfix">
|
||||
<h4>
|
||||
Users
|
||||
<span class="pull-right"><a href="{link name='channels'}">See All</a></span>
|
||||
</h4>
|
||||
<div class="row">
|
||||
|
||||
{foreach $users as $user}
|
||||
{$user_details = $userquery->get_user_details($user.userid)}
|
||||
{include file="$style_dir/blocks/user.html" display_type='normal'}
|
||||
{/foreach}
|
||||
</div><!-- users list -->
|
||||
</div><!-- users -->
|
||||
{/if}
|
||||
<div class="pagination-holder clearfix">
|
||||
<div class="pagination-holder clearfix">
|
||||
{include file="$style_dir/blocks/pagination.html"}
|
||||
</div>
|
||||
</div>
|
||||
{if !$videos && !$photos && !$users }
|
||||
<span class="well well-info btn-block">{lang code="no_search_results"}</span>
|
||||
{/if}
|
||||
|
||||
</div><!-- all users -->
|
||||
<div role="tabpanel" class="tab-pane {if $mode == 'videos'}active{/if}" id="videos-tab">
|
||||
<div class="search-sec clearfix visible-xs">
|
||||
<button type="button" class="btn btn-info btn-sm pull-right" data-toggle="modal" data-target="#filters-modal">Filters</button>
|
||||
</div>
|
||||
<div class="search-sec clearfix">
|
||||
<h4>
|
||||
Videos
|
||||
<span class="pull-right"><a href="{link name='videos'}">See All</a></span>
|
||||
</h4>
|
||||
<div class="all-search-holder clearfix">
|
||||
{if $videos}
|
||||
{foreach $videos as $video}
|
||||
{include file="$style_dir/blocks/video.html" display_type='normal'}
|
||||
{/foreach}
|
||||
<div class="pagination-holder clearfix">
|
||||
<div class="pagination-holder clearfix">
|
||||
{include file="$style_dir/blocks/pagination.html"}
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<span class="well well-info btn-block">{lang code="no_search_results"}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div><!-- videos -->
|
||||
</div><!-- all videos -->
|
||||
<div role="tabpanel" class="tab-pane {if $mode == 'photos'}active{/if}" id="photos-tab">
|
||||
<div class="search-sec clearfix visible-xs">
|
||||
<button type="button" class="btn btn-info btn-sm pull-right" data-toggle="modal" data-target="#filters-modal">Filters</button>
|
||||
</div>
|
||||
<div class="search-sec clearfix">
|
||||
<h4>
|
||||
photos
|
||||
<span class="pull-right"><a href="{link name='photos'}">See All</a></span>
|
||||
</h4>
|
||||
<div class="all-search-holder clearfix">
|
||||
{if $photos}
|
||||
{foreach $photos as $photo}
|
||||
{include file="$style_dir/blocks/photo.html"}
|
||||
{/foreach}
|
||||
<div class="pagination-holder clearfix">
|
||||
<div class="pagination-holder clearfix">
|
||||
{include file="$style_dir/blocks/pagination.html"}
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<span class="well well-info btn-block">{lang code="no_search_results"}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div><!-- photos -->
|
||||
</div><!-- all photos -->
|
||||
<div role="tabpanel" class="tab-pane {if $mode == 'channels'}active{/if}" id="users-tab">
|
||||
<div class="search-sec clearfix visible-xs">
|
||||
<button type="button" class="btn btn-info btn-sm pull-right" data-toggle="modal" data-target="#filters-modal">Filters</button>
|
||||
</div>
|
||||
<div class="search-sec clearfix">
|
||||
<h4>
|
||||
Users
|
||||
<span class="pull-right"><a href="{link name='channels'}">See All</a></span>
|
||||
</h4>
|
||||
<div class="row">
|
||||
{if $users}
|
||||
{foreach $users as $user}
|
||||
{$user_details = $userquery->get_user_details($user.userid)}
|
||||
{include file="$style_dir/blocks/user.html" display_type='normal'}
|
||||
{/foreach}
|
||||
<div class="pagination-holder clearfix">
|
||||
<div class="pagination-holder clearfix">
|
||||
{include file="$style_dir/blocks/pagination.html"}
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<span class="well well-info btn-block">{lang code="no_search_results"}</span>
|
||||
{/if}
|
||||
</div><!-- users list -->
|
||||
</div>
|
||||
</div><!-- users -->
|
||||
</div><!-- tab content -->
|
||||
</div><!-- left column -->
|
||||
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 hidden-xs">
|
||||
<div class="search-sort-by clearfix">
|
||||
<div class="sortby-holder">
|
||||
<span>Sort by:</span>
|
||||
<div class="dropdown">
|
||||
<button aria-expanded="true" data-toggle="dropdown" id="dropdownMenu1" type="button" class="btn btn-default dropdown-toggle">
|
||||
{if $smarty.get.search_by=='rel'}
|
||||
Relevance
|
||||
{elseif $smarty.get.search_by=='date'}
|
||||
Date
|
||||
{elseif $smarty.get.search_by=='views'}
|
||||
Popularity
|
||||
{else}
|
||||
Relevance
|
||||
{/if}
|
||||
<span class="caret-arrow"></span>
|
||||
</button>
|
||||
<ul aria-labelledby="dropdownMenu1" role="menu" class="dropdown-menu">
|
||||
<li role="presentation">
|
||||
<a href="?type={$smarty.get.type|form_val}&query={$smarty.get.query|form_val}&category={$category}&author={$smarty.get.author|form_val}&search_by=rel&s=elastic&p=search">Relevance</a>
|
||||
</li>
|
||||
<li role="presentation">
|
||||
<a href="?type={$smarty.get.type|form_val}&query={$smarty.get.query|form_val}&category={$category}&author={$smarty.get.author|form_val}&search_by=date&s=elastic&p=search">Date</a>
|
||||
</li>
|
||||
<li role="presentation">
|
||||
<a href="?type={$smarty.get.type|form_val}&query={$smarty.get.query|form_val}&category={$category}&author={$smarty.get.author|form_val}&search_by=views&s=elastic&p=search">Popularity</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-filter clearfix">
|
||||
{foreach $filter_results as $key => $filter}
|
||||
<div class="filter-col clearfix">
|
||||
{if $filter.0 != ''}
|
||||
|
||||
|
||||
<h4>{$key}</h4>
|
||||
<ul>
|
||||
{foreach $filter as $final}
|
||||
{if $final@iteration < 5}
|
||||
<li class="display">
|
||||
{if $key == 'CATEGORY' }
|
||||
{$category = $final}
|
||||
<a href="?type=videos&query={$smarty.get.query|form_val}&category={$category.id}&author={$smarty.get.author|form_val}&s=elastic&p=search">
|
||||
|
||||
{cleanString($final.source)} ( {$final.counts} )
|
||||
</a>
|
||||
{elseif $key == 'AUTHOR'}
|
||||
{$author = $final}
|
||||
<a href="?type=videos&query={$smarty.get.query|form_val}&category={$smarty.get.category|form_val}&author={$author.id}&s=elastic&p=search">{cleanString(name($final.source))} ( {$final.counts} )</a>
|
||||
{elseif $key == 'VIDEO' }
|
||||
{$video_name = $final}
|
||||
<a href="?type=videos&query={$smarty.get.query|form_val}&object={$video_name}&object_type=video&s=elastic&p=search">{cleanString($final)}</a>
|
||||
{elseif $key == 'GROUP' }
|
||||
{$group_name = $final}
|
||||
<a href="?type=groups&query={$smarty.get.query|form_val}&object={$group_name.id}&object_type=group&s=elastic&p=search">{cleanString($group_name.source)}</a>
|
||||
{elseif $key =='COLLECTION' }
|
||||
{$collection_name = $final}
|
||||
<a href="?type=collections&query={$smarty.get.query|form_val}&object={$collection_name.id}&object_type=collection&s=elastic&p=search">{cleanString($collection_name.source)}</a>
|
||||
{elseif $key == 'USER' }
|
||||
{$user_name = $final}
|
||||
<a href="?type=channels&query={$smarty.get.query|form_val}&object={$user_name}&object_type=user&s=elastic&p=search">{cleanString($final)}</a>
|
||||
{elseif $key == 'SOURCE' }
|
||||
<a href="?type={$final.key}&query={$smarty.get.query|form_val}&category={$smarty.get.category|form_val}&author={$smarty.get.author|form_val}&s=elastic&p=search">{cleanString($final.key)} ( {$final.doc_count} )</a>
|
||||
{else}
|
||||
<a href="javascript:void(0)">{cleanString($final)}</a>
|
||||
{/if}
|
||||
|
||||
</li>
|
||||
{else}
|
||||
{$flag = true}
|
||||
<li class="no-display hide" >
|
||||
{if $key == 'CATEGORY' }
|
||||
{$category = $final}
|
||||
<a href="?type=videos&query={$smarty.get.query|form_val}&category={$category.id}&author={$smarty.get.author|form_val}&s=elastic&p=search">{cleanString($final.source)} ( {$final.counts} )
|
||||
{elseif $key == 'AUTHOR'}
|
||||
{$author = $final}
|
||||
<a href="?type=videos&query={$smarty.get.query|form_val}&category={$smarty.get.category|form_val}&author={$author}&s=elastic&p=search">{cleanString($final)}</a>
|
||||
{elseif $key == 'VIDEO' }
|
||||
{$video_name = $final}
|
||||
<a href="?type=videos&query={$smarty.get.query|form_val}&object={$video_name}&object_type=video&s=elastic&p=search">{cleanString($final)}</a>
|
||||
{elseif $key == 'GROUP' }
|
||||
{$group_name = $final}
|
||||
<a href="?type=groups&query={$smarty.get.query|form_val}&object={$group_name.id}&object_type=group&s=elastic&p=search">{cleanString($final.source)} ( {$final.counts} )</a>
|
||||
{elseif $key =='COLLECTION' }
|
||||
{$collection_name = $final}
|
||||
<a href="?type=collections&query={$smarty.get.query|form_val}&object={$collection_name.id}&object_type=collection&s=elastic&p=search">{cleanString($final.source)} ( {$final.counts} )</a>
|
||||
{elseif $key == 'USER' }
|
||||
{$user_name = $final}
|
||||
<a href="?type=channels&query={$smarty.get.query|form_val}&object={$user_name}&object_type=user&s=elastic&p=search">{cleanString($final)}</a>
|
||||
{elseif $key == 'SOURCE' }
|
||||
{$source = explode(' ',$final)}
|
||||
{$source = $source.1}
|
||||
|
||||
<a href="?type={$source}&query={$smarty.get.query|form_val}&category={$smarty.get.author|form_val}&author={$smarty.get.author|form_val}&s=elastic&p=search">{cleanString($final)}</a>
|
||||
{else}
|
||||
<a href="javascript:void(0)">{cleanString($final)}</a>
|
||||
{/if}
|
||||
</li>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</ul>
|
||||
{if $flag}
|
||||
<a href="javascript:void(0)" class="more" >More...</a>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div><!-- right column -->
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
var more = true;
|
||||
$('.more').on("click",function(){
|
||||
if (more)
|
||||
{
|
||||
$(this).parent().find('.no-display').removeClass('hide');
|
||||
$(this).html("Less");
|
||||
|
||||
more = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).parent().find('.no-display').addClass('hide');
|
||||
$(this).html("More...");
|
||||
|
||||
more = true;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
208
upload/plugins/cb_elastic_search/search.php
Executable file
208
upload/plugins/cb_elastic_search/search.php
Executable file
|
@ -0,0 +1,208 @@
|
|||
<?php
|
||||
|
||||
|
||||
if(!defined('IN_CLIPBUCKET'))
|
||||
exit('Invalid access');
|
||||
|
||||
|
||||
$section = get('s');
|
||||
$file = get('p');
|
||||
|
||||
|
||||
if(defined('IN_MODULE') && $section=='elastic')
|
||||
{
|
||||
|
||||
|
||||
//Elastic Search Page
|
||||
if($file=='search')
|
||||
{
|
||||
|
||||
|
||||
$search_mode = mysql_clean($_GET['type']) ? mysql_clean($_GET['type']) : 'all';
|
||||
$page = mysql_clean($_GET['page']);
|
||||
$sort = mysql_clean($_GET['search_by']);
|
||||
$search = mysql_clean($_GET['query']);
|
||||
$page = $_GET['page'] ? $_GET['page'] : 1;
|
||||
|
||||
#pex($search_mode,1);
|
||||
|
||||
//pre($sort,1);
|
||||
|
||||
|
||||
switch ($search_mode) {
|
||||
case 'videos':{
|
||||
|
||||
$query = array();
|
||||
$es = new ElasticSearch($search_mode);
|
||||
if (isset($_GET['category']) && !empty($_GET['category'])){
|
||||
$es->filters["category"] = mysql_clean($_GET['category']);
|
||||
}
|
||||
if (isset($_GET['author']) && !empty($_GET['author'])){
|
||||
$es->filters["author"] = mysql_clean($_GET['author']);
|
||||
}
|
||||
$es->publicQuery = $search;
|
||||
if ($sort){
|
||||
$es->sort = $sort;
|
||||
}
|
||||
if ($page > 1){
|
||||
$from = $page - 1;
|
||||
$es->from = $from * $es->size;
|
||||
}
|
||||
$es->buildQuery();
|
||||
$es->ElasticSearch();
|
||||
$results = json_decode($es->results['result'],1);
|
||||
#pre($results,1);
|
||||
if ($results["hits"]["hits"]){
|
||||
$es->resultsHits = $results["hits"]["hits"];
|
||||
foreach ($es->resultsHits as $key => $video) {
|
||||
$newVideos[] = $video["_source"];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'photos':{
|
||||
|
||||
$query = array();
|
||||
$es = new ElasticSearch($search_mode);
|
||||
if (isset($_GET['category']) && !empty($_GET['category'])){
|
||||
$es->filters["category"] = mysql_clean($_GET['category']);
|
||||
}
|
||||
if (isset($_GET['author']) && !empty($_GET['author'])){
|
||||
$es->filters["author"] = mysql_clean($_GET['author']);
|
||||
}
|
||||
$es->publicQuery = $search;
|
||||
if ($sort){
|
||||
$es->sort = $sort;
|
||||
}
|
||||
if ($page > 1){
|
||||
$from = $page - 1;
|
||||
$es->from = $from * $es->size;
|
||||
}
|
||||
$es->buildQuery();
|
||||
$es->ElasticSearch();
|
||||
$results = json_decode($es->results['result'],1);
|
||||
#pex($results,1);
|
||||
if ($results["hits"]["hits"]){
|
||||
$es->resultsHits = $results["hits"]["hits"];
|
||||
foreach ($es->resultsHits as $key => $photo) {
|
||||
$newPhotos[] = $photo["_source"];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'channels':{
|
||||
|
||||
$query = array();
|
||||
$es = new ElasticSearch('users');
|
||||
if (isset($_GET['category']) && !empty($_GET['category'])){
|
||||
$es->filters["category"] = $_GET['category'];
|
||||
}
|
||||
if (isset($_GET['author']) && !empty($_GET['author'])){
|
||||
$es->filters["author"] = $_GET['author'];
|
||||
}
|
||||
$es->publicQuery = $search;
|
||||
if ($sort){
|
||||
$es->sort = $sort;
|
||||
}
|
||||
if ($page > 1){
|
||||
$from = $page - 1;
|
||||
$es->from = $from * $es->size;
|
||||
}
|
||||
$es->buildQuery();
|
||||
$es->ElasticSearch();
|
||||
$results = json_decode($es->results['result'],1);
|
||||
#pex($results,1);
|
||||
if ($results["hits"]["hits"]){
|
||||
$es->resultsHits = $results["hits"]["hits"];
|
||||
foreach ($es->resultsHits as $key => $user) {
|
||||
$newUsers[] = $user["_source"];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case 'all':
|
||||
default:{
|
||||
|
||||
$query = array();
|
||||
$es = new ElasticSearch(false);
|
||||
if (isset($_GET['category']) && !empty($_GET['category'])){
|
||||
$es->filters["category"] = $_GET['category'];
|
||||
}
|
||||
if (isset($_GET['author']) && !empty($_GET['author'])){
|
||||
$es->filters["author"] = $_GET['author'];
|
||||
}
|
||||
$es->publicQuery = $search;
|
||||
if ($sort){
|
||||
$es->sort = $sort;
|
||||
}
|
||||
if ($page > 1){
|
||||
$from = $page - 1;
|
||||
$es->from = $from * $es->size;
|
||||
}
|
||||
$es->buildQuery();
|
||||
$es->ElasticSearch();
|
||||
$results = json_decode($es->results['result'],1);
|
||||
#pex($results,1);
|
||||
if ($results["hits"]["hits"]){
|
||||
$es->resultsHits = $results["hits"]["hits"];
|
||||
foreach ($es->resultsHits as $key => $item) {
|
||||
if ($item["_index"] == 'videos'){
|
||||
$newVideos[] = $item["_source"];
|
||||
}
|
||||
if ($item["_index"] == 'users'){
|
||||
$newUsers[] = $item["_source"];
|
||||
}
|
||||
if ($item["_index"] == 'photos'){
|
||||
$newPhotos[] = $item["_source"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$filters = $es->makeFilters();
|
||||
assign("filter_results",$filters);
|
||||
|
||||
#pre($results,1);
|
||||
|
||||
|
||||
$get_limit = create_query_limit($page,10);
|
||||
$total_rows = $results["hits"]['total'];
|
||||
$total_pages = count_pages($total_rows,10);
|
||||
$pages->paginate($total_pages,$page);
|
||||
|
||||
|
||||
|
||||
|
||||
if (DEVELOPMENT_MODE)
|
||||
assign("time_took",$results["took"] / 1000);
|
||||
#pre($es->results['result'],1);
|
||||
assign("mode",$search_mode);
|
||||
assign("videos",$newVideos);
|
||||
assign("users",$newUsers);
|
||||
assign("photos",$newPhotos);
|
||||
|
||||
|
||||
template_files('search.html',CB_ES_DIR.'/');
|
||||
display_it();
|
||||
exit();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
442
upload/plugins/cb_elastic_search/test.html
Normal file
442
upload/plugins/cb_elastic_search/test.html
Normal file
|
@ -0,0 +1,442 @@
|
|||
|
||||
|
||||
|
||||
<div class="content-holder clearfix">
|
||||
<div class="right-section padding-left">
|
||||
<div class="content clearfix">
|
||||
<div class="main-container">
|
||||
<div class="search-nav-holder groups-nav clearfix">
|
||||
<ul class="search-nav nav nav-tabs" role="tablist">
|
||||
<li class="{if $mode == 'all'}active{/if}">
|
||||
<a href="?search_mode=all&query={$smarty.get.query|form_val}&category={$smarty.get.category|form_val}&author={$smarty.get.author|form_val}&search_by={$smarty.get.search_by|form_val}" >
|
||||
All
|
||||
</a>
|
||||
</li>
|
||||
<li class="{if $mode == 'videos'}active{/if}" >
|
||||
<a href="?search_mode=videos&query={$smarty.get.query|form_val}&category={$smarty.get.category|form_val}&author={$smarty.get.author|form_val}&search_by={$smarty.get.search_by|form_val}" >
|
||||
Videos
|
||||
</a>
|
||||
</li>
|
||||
<li class="{if $mode == 'groups'}active{/if}" >
|
||||
<a href="?search_mode=groups&query={$smarty.get.query|form_val}&category={$smarty.get.category|form_val}&author={$smarty.get.author|form_val}&search_by={$smarty.get.search_by|form_val}">
|
||||
Groups
|
||||
</a>
|
||||
</li>
|
||||
<li class="{if $mode == 'collections'}active{/if}" >
|
||||
<a href="?search_mode=collections&query={$smarty.get.query|form_val}&category={$smarty.get.category|form_val}&author={$smarty.get.author|form_val}&search_by={$smarty.get.search_by|form_val}" >
|
||||
Collections</a>
|
||||
</li>
|
||||
<li class="{if $mode == 'users'}active{/if}" >
|
||||
<a href="?search_mode=users&query={$smarty.get.query|form_val}&category={$smarty.get.category|form_val}&author={$smarty.get.author|form_val}&search_by={$smarty.get.search_by|form_val}" >
|
||||
Users</a>
|
||||
</li>
|
||||
</ul>
|
||||
{if $time_took}
|
||||
<span class="pull-right label label label-info">
|
||||
{$time_took} seconds
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
</div><!-- search Nav -->
|
||||
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-9 col-md-9 col-sm-8 col-xs-12">
|
||||
<div class="search-sec clearfix visible-xs">
|
||||
<button type="button" class="btn btn-info btn-sm pull-right" data-toggle="modal" data-target="#filters-modal">Filters</button>
|
||||
</div>
|
||||
<div class="tab-content">
|
||||
<div role="tabpanel" class="tab-pane {if $mode == 'all'}active{/if}" id="all-tab">
|
||||
{if $videos}
|
||||
<div class="search-sec clearfix">
|
||||
<h3>
|
||||
Videos
|
||||
<span class="pull-right"><a href="{link name='videos'}">See All</a></span>
|
||||
</h3>
|
||||
<div class="all-search-holder clearfix">
|
||||
{foreach $videos as $video}
|
||||
<div class="col-lg-4 col-md-4 col-sm-6 col-xs-6 category-col">
|
||||
<div class="category-box">
|
||||
<a href="{$video.video_link}">
|
||||
<!-- <img src="{get_thumb vdetails=$video size='320x200'}" alt="" class="img-responsive"> -->
|
||||
<img src="{get_thumb vdetails=$video.videoid size='320x200'}" alt="" class="img-responsive">
|
||||
<div class="like-comments">
|
||||
<span><i class="like"></i>{$video.likes}</span>
|
||||
<span><i class="comments"></i>{$video.comments_count}</span>
|
||||
</div>
|
||||
</a>
|
||||
<a href="{$video.video_link}" class="mask-icon">
|
||||
<span class="video-icon"></span>
|
||||
</a>
|
||||
</div>
|
||||
<h4>{$video.title}</h4>
|
||||
<p>{name($video)}</p>
|
||||
<div class="view-date clearfix">
|
||||
<span><i class="view"></i>{$video.views} views</span>
|
||||
<span><i class="date"></i>{$video.date_added|date_format} </span>
|
||||
</div>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div><!-- videos -->
|
||||
{/if}
|
||||
{if $groups}
|
||||
<div class="search-sec clearfix">
|
||||
<h3>
|
||||
Groups
|
||||
<span class="pull-right"><a href="{link name='groups'}">See All</a></span>
|
||||
</h3>
|
||||
<div class="all-search-holder clearfix">
|
||||
{foreach $groups as $group}
|
||||
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-6 category-col">
|
||||
<div class="category-box">
|
||||
<a href="{$group.group_url}">
|
||||
<img src="{$cbgroup->get_group_thumb($group,'110')}" alt="" class="img-responsive">
|
||||
<div class="search-group-circle">{$group.total_videos}<span>Videos</span></div>
|
||||
</a>
|
||||
</div>
|
||||
<h4 class="search-heading">{$group.group_name} </h4>
|
||||
<p class="search-para">{$group.ATCategory}</p>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div><!-- Groups -->
|
||||
{/if}
|
||||
{if $collections}
|
||||
<div class="search-sec clearfix">
|
||||
<h3>
|
||||
Collection
|
||||
<span class="pull-right"><a href="{link name='collections'}">See All</a></span>
|
||||
</h3>
|
||||
<div class="all-search-holder clearfix">
|
||||
{foreach $collections as $collection}
|
||||
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-6 category-col">
|
||||
<div class="category-box">
|
||||
<a href="{$collection.U}">
|
||||
<img src="{$cbgroup->get_group_thumb($collection,'110')}" alt="" class="img-responsive">
|
||||
<div class="search-group-circle">{$collection.total_videos}<span>Videos</span></div>
|
||||
</a>
|
||||
</div>
|
||||
<h4 class="search-heading">{$collection.group_name}</h4>
|
||||
<p class="search-para">{$collection.ATCategory}</p>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div><!-- Collections -->
|
||||
{/if}
|
||||
{if $users}
|
||||
<div class="search-sec clearfix">
|
||||
<h3>
|
||||
Users
|
||||
<span class="pull-right"><a href="{link name='channels'}">See All</a></span>
|
||||
</h3>
|
||||
<div class="row">
|
||||
|
||||
{foreach $users as $user}
|
||||
{$user_details = $userquery->get_user_details($user.userid)}
|
||||
<div class="user-col">
|
||||
<a href="{$userquery->profile_link($user_details)}" {ANCHOR place='lync_info' data=$user_details} >
|
||||
<img src="{avatar details=$user_details}" alt="" class="img-responsive">
|
||||
</a>
|
||||
<div class="popper-content clearfix hide">
|
||||
<div class="img-holder">
|
||||
<img src="{avatar details=$user_details}" alt="" class="img-responsive">
|
||||
</div>
|
||||
<div class="content-user">
|
||||
<h4>{name($user_details)}</h4>
|
||||
<p><span>{$user.total_videos} {if $user.total_videos > 1}videos {else} video {/if}</span> | <span>{$user.views} Views</span>
|
||||
</p>
|
||||
</div>
|
||||
</div><!-- popper-content -->
|
||||
<h4>{name($user_details)}</h4>
|
||||
<p><span>{$user.total_videos} {if $user.total_videos > 1}videos {else}
|
||||
video {/if}</span> | <span>{$user.views} Views</span></p>
|
||||
</div><!-- user-col -->
|
||||
{/foreach}
|
||||
</div><!-- users list -->
|
||||
</div><!-- users -->
|
||||
{/if}
|
||||
<div class="pagination-holder clearfix">
|
||||
<div class="pagination-holder clearfix">
|
||||
{include file="$style_dir/blocks/pagination.html"}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if !$videos && !$groups && !$collections && !$users }
|
||||
<span class="well well-info btn-block">{lang code="no_search_results"}</span>
|
||||
{/if}
|
||||
|
||||
</div><!-- all users -->
|
||||
<div role="tabpanel" class="tab-pane {if $mode == 'videos'}active{/if}" id="videos-tab">
|
||||
<div class="search-sec clearfix visible-xs">
|
||||
<button type="button" class="btn btn-info btn-sm pull-right" data-toggle="modal" data-target="#filters-modal">Filters</button>
|
||||
</div>
|
||||
<div class="search-sec clearfix">
|
||||
<h3>
|
||||
Videos
|
||||
<span class="pull-right"><a href="{link name='videos'}">See All</a></span>
|
||||
</h3>
|
||||
<div class="all-search-holder clearfix">
|
||||
{if $videos}
|
||||
{foreach $videos as $video}
|
||||
<div class="col-lg-4 col-md-4 col-sm-6 col-xs-6 category-col">
|
||||
<div class="category-box">
|
||||
<a href="{$video.video_link}">
|
||||
<!-- <img src="{get_thumb vdetails=$video size='320x200'}" alt="" class="img-responsive"> -->
|
||||
<img src="{get_thumb vdetails=$video.videoid size='320x200'}" alt="" class="img-responsive">
|
||||
<div class="like-comments">
|
||||
<span><i class="like"></i>{$video.likes}</span>
|
||||
<span><i class="comments"></i>{$video.comments_count}</span>
|
||||
</div>
|
||||
</a>
|
||||
<a href="{$video.video_link}" class="mask-icon">
|
||||
<span class="video-icon"></span>
|
||||
</a>
|
||||
</div>
|
||||
<h4>{$video.title}</h4>
|
||||
<p>{name($video)}</p>
|
||||
<div class="view-date clearfix">
|
||||
<span><i class="view"></i>{$video.views} views</span>
|
||||
<span><i class="date"></i>{$video.date_added|date_format} </span>
|
||||
</div>
|
||||
</div>
|
||||
{/foreach}
|
||||
<div class="pagination-holder clearfix">
|
||||
<div class="pagination-holder clearfix">
|
||||
{include file="$style_dir/blocks/pagination.html"}
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<span class="well well-info btn-block">{lang code="no_search_results"}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div><!-- videos -->
|
||||
</div><!-- all videos -->
|
||||
<div role="tabpanel" class="tab-pane {if $mode == 'groups'}active{/if}" id="groups-tab">
|
||||
<div class="search-sec clearfix visible-xs">
|
||||
<button type="button" class="btn btn-info btn-sm pull-right" data-toggle="modal" data-target="#filters-modal">Filters</button>
|
||||
</div>
|
||||
<div class="search-sec clearfix">
|
||||
<h3>
|
||||
Groups
|
||||
<span class="pull-right"><a href="{link name='groups'}">See All</a></span>
|
||||
</h3>
|
||||
<div class="all-search-holder clearfix">
|
||||
{if $groups}
|
||||
{foreach $groups as $group}
|
||||
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-6 category-col">
|
||||
<div class="category-box">
|
||||
<a href="{$group.group_url}">
|
||||
<img src="{$cbgroup->get_group_thumb($group,'110')}" alt="" class="img-responsive">
|
||||
<div class="search-group-circle">{$group.total_videos}<span>Videos</span></div>
|
||||
</a>
|
||||
</div>
|
||||
<h4 class="search-heading">{$group.group_name} </h4>
|
||||
<p class="search-para">{$group.ATCategory}</p>
|
||||
</div>
|
||||
{/foreach}
|
||||
<div class="pagination-holder clearfix">
|
||||
<div class="pagination-holder clearfix">
|
||||
{include file="$style_dir/blocks/pagination.html"}
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<span class="well well-info btn-block">{lang code="no_search_results"}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- Groups -->
|
||||
<div role="tabpanel" class="tab-pane {if $mode == 'collections'}active{/if}" id="collections-tab">
|
||||
<div class="search-sec clearfix visible-xs">
|
||||
<button type="button" class="btn btn-info btn-sm pull-right" data-toggle="modal" data-target="#filters-modal">Filters</button>
|
||||
</div>
|
||||
<div class="search-sec clearfix">
|
||||
<h3>
|
||||
Collections
|
||||
<span class="pull-right"><a href="{link name='collections'}">See All</a></span>
|
||||
</h3>
|
||||
<div class="all-search-holder clearfix">
|
||||
{if $collections}
|
||||
{foreach $collections as $collection}
|
||||
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-6 category-col">
|
||||
<div class="category-box">
|
||||
<a href="{$collection.U}">
|
||||
<img src="{$cbgroup->get_group_thumb($collection,'110')}" alt="" class="img-responsive">
|
||||
<div class="search-group-circle">{$collection.total_videos}<span>Videos</span></div>
|
||||
</a>
|
||||
</div>
|
||||
<h4 class="search-heading">{$collection.group_name}</h4>
|
||||
<p class="search-para">{$collection.ATCategory}</p>
|
||||
</div>
|
||||
{/foreach}
|
||||
<div class="pagination-holder clearfix">
|
||||
<div class="pagination-holder clearfix">
|
||||
{include file="$style_dir/blocks/pagination.html"}
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<span class="well well-info btn-block">{lang code="no_search_results"}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- Collections -->
|
||||
<div role="tabpanel" class="tab-pane {if $mode == 'users'}active{/if}" id="users-tab">
|
||||
<div class="search-sec clearfix visible-xs">
|
||||
<button type="button" class="btn btn-info btn-sm pull-right" data-toggle="modal" data-target="#filters-modal">Filters</button>
|
||||
</div>
|
||||
<div class="search-sec clearfix">
|
||||
<h3>
|
||||
Users
|
||||
<span class="pull-right"><a href="{link name='channels'}">See All</a></span>
|
||||
</h3>
|
||||
<div class="row">
|
||||
{if $users}
|
||||
{foreach $users as $user}
|
||||
{$user_details = $userquery->get_user_details($user.userid)}
|
||||
<div class="user-col">
|
||||
<a href="{$userquery->profile_link($user_details)}" {ANCHOR place='lync_info' data=$user_details} >
|
||||
<img src="{avatar details=$user_details}" alt="" class="img-responsive">
|
||||
</a>
|
||||
<div class="popper-content clearfix hide">
|
||||
<div class="img-holder">
|
||||
<img src="{avatar details=$user_details}" alt="" class="img-responsive">
|
||||
</div>
|
||||
<div class="content-user">
|
||||
<h4>{name($user_details)}</h4>
|
||||
<p><span>{$user.total_videos} {if $user.total_videos > 1}videos {else} video {/if}</span> | <span>{$user.views} Views</span>
|
||||
</p>
|
||||
</div>
|
||||
</div><!-- popper-content -->
|
||||
<h4>{name($user_details)}</h4>
|
||||
<p><span>{$user.total_videos} {if $user.total_videos > 1}videos {else}
|
||||
video {/if}</span> | <span>{$user.views} Views</span></p>
|
||||
</div><!-- user-col -->
|
||||
{/foreach}
|
||||
<div class="pagination-holder clearfix">
|
||||
<div class="pagination-holder clearfix">
|
||||
{include file="$style_dir/blocks/pagination.html"}
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<span class="well well-info btn-block">{lang code="no_search_results"}</span>
|
||||
{/if}
|
||||
</div><!-- users list -->
|
||||
</div>
|
||||
</div><!-- users -->
|
||||
</div><!-- tab content -->
|
||||
</div><!-- left column -->
|
||||
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 hidden-xs">
|
||||
<div class="search-sort-by clearfix">
|
||||
<div class="sortby-holder">
|
||||
<span>Sort by:</span>
|
||||
<div class="dropdown">
|
||||
<button aria-expanded="true" data-toggle="dropdown" id="dropdownMenu1" type="button" class="btn btn-default dropdown-toggle">
|
||||
{if $smarty.get.search_by=='rel'}
|
||||
Relevance
|
||||
{elseif $smarty.get.search_by=='date'}
|
||||
Date
|
||||
{elseif $smarty.get.search_by=='views'}
|
||||
Popularity
|
||||
{else}
|
||||
Relevance
|
||||
{/if}
|
||||
<span class="caret-arrow"></span>
|
||||
</button>
|
||||
<ul aria-labelledby="dropdownMenu1" role="menu" class="dropdown-menu">
|
||||
<li role="presentation">
|
||||
<a href="?search_mode={$smarty.get.search_mode|form_val}&query={$smarty.get.query|form_val}&category={$category}&author={$smarty.get.author|form_val}&search_by=rel">Relevance</a>
|
||||
</li>
|
||||
<li role="presentation">
|
||||
<a href="?search_mode={$smarty.get.search_mode|form_val}&query={$smarty.get.query|form_val}&category={$category}&author={$smarty.get.author|form_val}&search_by=date">Date</a>
|
||||
</li>
|
||||
<li role="presentation">
|
||||
<a href="?search_mode={$smarty.get.search_mode|form_val}&query={$smarty.get.query|form_val}&category={$category}&author={$smarty.get.author|form_val}&search_by=views">Popularity</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-filter clearfix">
|
||||
{foreach $filter_results as $key => $filter}
|
||||
<div class="filter-col clearfix">
|
||||
{if $filter.0 != ''}
|
||||
|
||||
|
||||
<h4>{$key}</h4>
|
||||
<ul>
|
||||
{foreach $filter as $final}
|
||||
{if $final@iteration < 5}
|
||||
<li class="display">
|
||||
{if $key == 'CATEGORY' }
|
||||
{$category = $final}
|
||||
<a href="?search_mode=videos&query={$smarty.get.query|form_val}&category={$category.id}&author={$smarty.get.author|form_val}">
|
||||
|
||||
{cleanString($final.source)} ( {$final.counts} )
|
||||
</a>
|
||||
{elseif $key == 'AUTHOR'}
|
||||
{$author = $final}
|
||||
<a href="?search_mode=videos&query={$smarty.get.query|form_val}&category={$smarty.get.category|form_val}&author={$author.id}">{cleanString(name($final.source))} ( {$final.counts} )</a>
|
||||
{elseif $key == 'VIDEO' }
|
||||
{$video_name = $final}
|
||||
<a href="?search_mode=videos&query={$smarty.get.query|form_val}&object={$video_name}&object_type=video">{cleanString($final)}</a>
|
||||
{elseif $key == 'GROUP' }
|
||||
{$group_name = $final}
|
||||
<a href="?search_mode=groups&query={$smarty.get.query|form_val}&object={$group_name.id}&object_type=group">{cleanString($group_name.source)}</a>
|
||||
{elseif $key =='COLLECTION' }
|
||||
{$collection_name = $final}
|
||||
<a href="?search_mode=collections&query={$smarty.get.query|form_val}&object={$collection_name.id}&object_type=collection">{cleanString($collection_name.source)}</a>
|
||||
{elseif $key == 'USER' }
|
||||
{$user_name = $final}
|
||||
<a href="?search_mode=users&query={$smarty.get.query|form_val}&object={$user_name}&object_type=user">{cleanString($final)}</a>
|
||||
{elseif $key == 'SOURCE' }
|
||||
<a href="?search_mode={$final.key}&query={$smarty.get.query|form_val}&category={$smarty.get.category|form_val}&author={$smarty.get.author|form_val}">{cleanString($final.key)} ( {$final.doc_count} )</a>
|
||||
{else}
|
||||
<a href="javascript:void(0)">{cleanString($final)}</a>
|
||||
{/if}
|
||||
|
||||
</li>
|
||||
{else}
|
||||
{$flag = true}
|
||||
<li class="no-display hide" >
|
||||
{if $key == 'CATEGORY' }
|
||||
{$category = $final}
|
||||
<a href="?search_mode=videos&query={$smarty.get.query|form_val}&category={$category.id}&author={$smarty.get.author|form_val}">{cleanString($final.source)} ( {$final.counts} )
|
||||
{elseif $key == 'AUTHOR'}
|
||||
{$author = $final}
|
||||
<a href="?search_mode=videos&query={$smarty.get.query|form_val}&category={$smarty.get.category|form_val}&author={$author}">{cleanString($final)}</a>
|
||||
{elseif $key == 'VIDEO' }
|
||||
{$video_name = $final}
|
||||
<a href="?search_mode=videos&query={$smarty.get.query|form_val}&object={$video_name}&object_type=video">{cleanString($final)}</a>
|
||||
{elseif $key == 'GROUP' }
|
||||
{$group_name = $final}
|
||||
<a href="?search_mode=groups&query={$smarty.get.query|form_val}&object={$group_name.id}&object_type=group">{cleanString($final.source)} ( {$final.counts} )</a>
|
||||
{elseif $key =='COLLECTION' }
|
||||
{$collection_name = $final}
|
||||
<a href="?search_mode=collections&query={$smarty.get.query|form_val}&object={$collection_name.id}&object_type=collection">{cleanString($final.source)} ( {$final.counts} )</a>
|
||||
{elseif $key == 'USER' }
|
||||
{$user_name = $final}
|
||||
<a href="?search_mode=users&query={$smarty.get.query|form_val}&object={$user_name}&object_type=user">{cleanString($final)}</a>
|
||||
{elseif $key == 'SOURCE' }
|
||||
{$source = explode(' ',$final)}
|
||||
{$source = $source.1}
|
||||
|
||||
<a href="?search_mode={$source}&query={$smarty.get.query|form_val}&category={$smarty.get.author|form_val}&author={$smarty.get.author|form_val}">{cleanString($final)}</a>
|
||||
{else}
|
||||
<a href="javascript:void(0)">{cleanString($final)}</a>
|
||||
{/if}
|
||||
</li>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</ul>
|
||||
{if $flag}
|
||||
<a href="javascript:void(0)" class="more" >More...</a>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div><!-- right column -->
|
||||
</div>
|
||||
</div><!-- content -->
|
||||
</div><!-- content -->
|
||||
</div>
|
||||
</div><!-- content -->
|
0
upload/plugins/cb_elastic_search/uninstall_elastic_search.php
Executable file
0
upload/plugins/cb_elastic_search/uninstall_elastic_search.php
Executable file
Loading…
Add table
Reference in a new issue