[Sputnik-list] Who know luasoket and lpack ? (For Sphinx full text
search)
pierre pracht
pierre.pracht at gmail.com
Wed Feb 20 14:18:53 GMT+2 2008
Sphinx is a full-text search engine. http://sphinxsearch.com/
I was tring to convert api/sphinxapi.py to lua
(See in sphinx-0.9.8-svn-r1112.tar.gz (544 KB) )
I managed to send query correctly : Sphinx:Query
But I get nuts with Sphinx:GetReponse
lpack use a different notation than pack in python and I haven't
really understood it.
I get some doubt that I can do : sock:receive(8) with luasocket.
If someone has some insight on those modules ?
I post here in case someone would take on.
Using sphinx may interest you.
Personally I give up.
- pierre
-- get and check response packet from searchd server
local function GetReponse(self,sock,client_ver)
-------------------------------------------------------------
-- Who know luasoket and lpack ?
--------------------------------------------------------------
--
--004 00 00 01 12 00 00 00 72 00 00 00 02 00 00 00
05 .......r ........
--014 74 69 74 6c 65 00 00 00 04 62 6f 64 79 00 00 00
title... .body...
--024 02 00 00 00 03 67 69 64 00 00 00 01 00 00 00
02 .....gid ........
--034 74 73 00 00 00 02 00 00 00 02 00 00 00 7b 00 00 ts...... .....
{..
--044 00 64 00 00 00 2d 43 7c 5c 0a 00 00 01 41 00 00 .d...-C|
\....A..
--054 00 64 00 00 00 2d 43 7c 5c 0a 00 00 00 02 00 00 .d...-C|
\.......
--064 00 02 00 00 00 01 00 00 00 01 00 00 00 04 74
65 ........ ......te
--074 73 74 00 00 00 02 00 00 00 02 st...... ..
--
-- is receive(8) allowed ?
local status, ver, length = bunpack(sock:receive(8),">2HL")
print("status :"..status) -- O => 00 00
print("ver :"..ver) -- 274 => 01 12
print("length :"..length) -- 114 => 00 00 00 72
local reponse_tab = {}
local left = length
while left>0 do
print("left :"..left)
local chunck = sock:receive(left)
if chunck ~= "" then
table.insert(reponse_tab,chunck)
left = left - #chunck
else
break
end
end
local reponse = table.concat(reponse_tab)
-------------- next part --------------
Skipped content of type multipart/mixed
More information about the Sputnik-list
mailing list