Skip to content

Instantly share code, notes, and snippets.

View tomatolog's full-sized avatar

Stas tomatolog

View GitHub Profile
@tomatolog
tomatolog / new_invoice.py
Last active February 24, 2018 10:37
add file with next number
import os, sys, re
def die(s):
print s
sys.exit ( 1 )
invoice_name = "invoice_"
got_files = []
cwd = os.getcwd()
@tomatolog
tomatolog / con1.lua
Created January 11, 2017 11:28
luasql mysql issue #22
local luasql = nil
local json = require('cjson')
local ENV = nil
local CONN = nil
local CUR = nil
local result = {}
local dbname = 'DB_NAME_HERE'
local dbuser = 'DB_USER_NAME_HERE'
@tomatolog
tomatolog / master_macos_fix.patch
Created April 26, 2016 07:06
master_macos_fix
src/searchdha.cpp | 3 +++
src/sphinx.cpp | 4 ++--
src/sphinxstd.cpp | 2 ++
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/searchdha.cpp b/src/searchdha.cpp
index 27bc01e..2af933d 100644
--- a/src/searchdha.cpp
+++ b/src/searchdha.cpp
@@ -21,6 +21,9 @@
src/searchdha.cpp | 3 +++
src/sphinx.cpp | 4 ++--
src/sphinxstd.cpp | 2 ++
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/searchdha.cpp b/src/searchdha.cpp
index 27bc01e..2af933d 100644
--- a/src/searchdha.cpp
+++ b/src/searchdha.cpp
@@ -21,6 +21,9 @@
mysql_query("SET AUTOCOMMIT=0", $c2) or die("sphinx SET AUTOCOMMIT failed: " . mysql_error($c2));
mysql_query("TRUNCATE RTINDEX rt", $c2) or die("sphinx TRUNCATE failed: " . mysql_error($c2));
$r1 = mysql_unbuffered_query("SELECT id, title, UNCOMPRESS(content), CRC32(title) FROM index", $c1) or die("mysql fetch failed: " . mysql_error($c1));
while (list($id, $title, $content, $gid) = mysql_fetch_row($r1))
{
$t += strlen($title) + strlen($content);
$title = mysql_real_escape_string($title);
$content = mysql_real_escape_string($content);
mysql_query("INSERT INTO rt (id, title, content, gid) VALUES ($id, '$title', '$content', $gid)", $c2) or die("sphinx insert failed: " . mysql_error($c2));
mysql> CALL SNIPPETS('rock music', 'test_multi', 'rock', 1 AS query_mode);
| <b>rock music</b> |
mysql> CALL SNIPPETS('trial period', 'test_multi', 'rock', 1 AS query_mode);
| trial period |
mysql> CALL SNIPPETS('trial period', 'test_multi', 'test', 1 AS query_mode);
| <b>trial period</b> |
mysql> CALL SNIPPETS('trial period', 'test_multi', 'trial', 1 AS query_mode);
bool sphWildcardMatch ( const char * sString, const char * sPattern, int iDepth )
{
if ( !sString || !sPattern || !*sString || !*sPattern )
return false;
int dTmp [SPH_MAX_WORD_LEN+1][SPH_MAX_WORD_LEN+1];
const char * s = sString;
const char * p = sPattern;
dTmp[0][0] = 1;
import os, sys, base64, select, socket, struct, datetime, time, traceback
host_all = '127.0.0.1'
port_sql = 0
port_api = 0
packet_max_len = 16384
verbose = 0
debug = 0
banner_ql = '--- crashed SphinxQL request dump ---'

Test me

how to edit that?

src/searchd.cpp | 49 +++++++++++++++++++++++++++++++++++--------------
1 file changed, 35 insertions(+), 14 deletions(-)
diff --git a/src/searchd.cpp b/src/searchd.cpp
index ab2d09d..2af6fe0 100644
--- a/src/searchd.cpp
+++ b/src/searchd.cpp
@@ -9854,9 +9854,11 @@ bool SearchHandler_c::RunLocalSearch ( int iLocal, ISphMatchSorter ** ppSorters,
const int iQueries = m_iEnd-m_iStart+1;