New version of kohana sphinxql from working project

This commit is contained in:
Kirill 2012-01-29 23:37:32 +06:00
parent bba58121a6
commit a2739bc749
36 changed files with 30 additions and 8 deletions

0
LICENSE Normal file → Executable file
View File

13
README Normal file → Executable file
View File

@ -1,9 +1,18 @@
SphinxQL for Kohana 3.2
SphinxQL for Kohana
===================
Overview
--------
This is sphinx plugin for kohana 3.2
I wrote this because the other Kohana Sphinx plugin on github was reliant on
the pure PHP sphinx API and was discontinued. This plugin, as suggested by its
name, uses the SphinxQL interface. This means there's less dependancies as it
uses the built-in MySQL interface from PHP. _NOTE_: to use this, MySQL server
does _NOT_ need to be installed on the server. Only the MySQL client library for
PHP is required. As the MySQL interface in PHP is built as an extension, it's
faster than the regular Sphinx API as well, you can check the benchmarks out
here: http://sphinxsearch.com/blog/2010/04/25/sphinxapi-vs-sphinxql-benchmark/
Requirements
------------

0
classes/kohana/sphinxql.php Normal file → Executable file
View File

16
classes/kohana/sphinxql/client.php Normal file → Executable file
View File

@ -73,10 +73,22 @@ class Kohana_SphinxQL_Client {
*/
public function query($query) {
$this->_result = false;
if (is_string($query) && $this->connect()) { $this->_result = mysql_query($query, $this->_handle); }
if (is_string($query) && $this->connect()) {
@$this->_result = mysql_query($query, $this->_handle);
}
return $this;
}
public function total_find() {
$result = mysql_query("SHOW META");
if($result) {
$result = mysql_fetch_assoc($result);
return intval($result['Value']);
} else {
return 0;
}
}
/**
* Fetch one row of the result set
*
@ -101,4 +113,4 @@ class Kohana_SphinxQL_Client {
}
}
?>
?>

6
classes/kohana/sphinxql/core.php Normal file → Executable file
View File

@ -75,11 +75,13 @@ class Kohana_SphinxQL_Core {
if (!is_a($query, 'SphinxQL_Query') && !is_string($query)) { return false; }
while (($names = array_keys(self::$_handles)) && count($names) && ($name = $names[intval(rand(0, count($names)-1))])) {
$client = self::$_handles[$name];
$return = $client->query((string)$query)->fetch_all();
$result = $client->query((string)$query);
$return['data'] = $client->query((string)$query)->fetch_all();
$return['total'] = $client->total_find();
if (is_array($return)) { return $return; } else { unset(self::$_handles[$name]); }
}
return false;
}
}
?>
?>

0
classes/kohana/sphinxql/query.php Normal file → Executable file
View File

0
classes/sphinxql.php Normal file → Executable file
View File

0
classes/sphinxql/client.php Normal file → Executable file
View File

0
classes/sphinxql/core.php Normal file → Executable file
View File

0
classes/sphinxql/query.php Normal file → Executable file
View File

3
config/sphinxql.php Normal file → Executable file
View File

@ -26,10 +26,9 @@ return array(
//'sphinx_second' => '123.45.67.89:8765',
// ...or!
//'my_only_server' => '127.0.0.1:2222',
'my_only_server' => '127.0.0.1:9312',
),
),
);
?>
?>

0
docs/classtrees_kohana-sphinxql.html Normal file → Executable file
View File

0
docs/elementindex.html Normal file → Executable file
View File

0
docs/elementindex_kohana-sphinxql.html Normal file → Executable file
View File

0
docs/errors.html Normal file → Executable file
View File

0
docs/index.html Normal file → Executable file
View File

0
docs/kohana-sphinxql/Kohana_SphinxQL.html Normal file → Executable file
View File

0
docs/kohana-sphinxql/Kohana_SphinxQL_Client.html Normal file → Executable file
View File

0
docs/kohana-sphinxql/Kohana_SphinxQL_Core.html Normal file → Executable file
View File

0
docs/kohana-sphinxql/Kohana_SphinxQL_Query.html Normal file → Executable file
View File

0
docs/kohana-sphinxql/SphinxQL.html Normal file → Executable file
View File

0
docs/kohana-sphinxql/SphinxQL_Client.html Normal file → Executable file
View File

0
docs/kohana-sphinxql/SphinxQL_Core.html Normal file → Executable file
View File

0
docs/kohana-sphinxql/SphinxQL_Query.html Normal file → Executable file
View File

View File

View File

View File

0
docs/kohana-sphinxql/_kohana---sphinxql.php.html Normal file → Executable file
View File

0
docs/kohana-sphinxql/_sphinxql---client.php.html Normal file → Executable file
View File

0
docs/kohana-sphinxql/_sphinxql---core.php.html Normal file → Executable file
View File

0
docs/kohana-sphinxql/_sphinxql---query.php.html Normal file → Executable file
View File

0
docs/kohana-sphinxql/_sphinxql.php.html Normal file → Executable file
View File

0
docs/li_kohana-sphinxql.html Normal file → Executable file
View File

0
docs/media/layout.css Normal file → Executable file
View File

0
docs/media/print.css Normal file → Executable file
View File

0
docs/media/style.css Normal file → Executable file
View File