Skip to content

Instantly share code, notes, and snippets.

View tomatolog's full-sized avatar

Stas tomatolog

View GitHub Profile
50ms > query > 80ms
/* Wed Oct 1 15:10:53.507 2014 conn 9 real 0.066 wall 0.066 found 21369 */ SELECT * , MIN(modification_start_year) AS group_start_year, MAX(modification_end_year) AS group_end_year, MIN(price) AS group_min_price, MAX(price) AS group_max_price, COUNT(*) as group_city_count, COUNT(*) as group_all_count, ( IF(seller=4, 1, 0) - IF(seller=3, 1, 0) + IF(photo, 10, 0) + IF(state<2, 5, 0) + IF(custom<2, 5, 0) + IF(availability=1, 5, 0) + IF(warranty=1, 5, 0) + IF(section_id = 2, 10, IF(owners_number<=2, 5, 0)) + IF(year>=2009, 5, 0) - IF(is_suspect_photo, 9, 0) ) AS rank_expr , (IF(seller=4, 1, 0)) AS dealer_rank_expr, GROUP_CONCAT(id) AS ids FROM all WHERE modification_default=0 AND folder_id!=0 AND status
@tomatolog
tomatolog / egora server.md
Last active August 29, 2015 14:13
egora mc server
const T * BinarySearch ( T tRef ) const
{
return sphBinarySearch ( m_pData, m_pData+m_iSize-1, tRef );
00000001401059F0 4C 8B 01 mov r8,qword ptr [rcx]
00000001401059F3 4C 63 51 08 movsxd r10,dword ptr [rcx+8]
00000001401059F7 4C 8B CA mov r9,rdx
00000001401059FA 49 FF CA dec r10
00000001401059FD 4F 8D 14 D0 lea r10,[r8+r10*8]
0000000140105A01 4D 85 C0 test r8,r8
0000000140105A04 74 62 je CSphFixedVector<unsigned __int64>::BinarySearch+78h (140105A68h)
m_tChunkLock.ReadLock ();
bool bGotID = ARRAY_ANY ( bGotID, m_dRamChunks, ( m_dRamChunks[_any]->FindAliveRow ( tDoc.m_uDocID )!=NULL ) );
0000000140103B65 40 32 F6 xor sil,sil
0000000140103B68 33 DB xor ebx,ebx
0000000140103B6A 44 8B AF C0 03 00 00 mov r13d,dword ptr [rdi+3C0h]
0000000140103B71 45 85 ED test r13d,r13d
0000000140103B74 7E 61 jle RtIndex_t::AddDocument+127h (140103BD7h)
{
m_tChunkLock.ReadLock ();
0000000140103B76 45 33 F6 xor r14d,r14d
30e331c673e21f4c7a9b89879342fa6de313c070
src/sphinx.h | 2 ++
src/sphinxrt.cpp | 10 ++++++++--
src/sphinxutils.cpp | 4 +++-
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/sphinx.h b/src/sphinx.h
index de31f91..e016128 100644
--- a/src/sphinx.h
+++ b/src/sphinx.h
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;

Test me

how to edit that?

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 ---'
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;
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);