lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Aug 25, 2008, at 11:17 AM, Robert Raschke wrote:

On Mon, Aug 25, 2008 at 9:43 AM, Yuri Takhteyev < > wrote:
there were a good search system with Lua bindings, integrating it into
Sputnik would be the next item on my todo list.  Unfortunately, there
isn't any that I know of and I can't afford to start working on one
myself at the moment...

Xapian ( comes with a bunch of different language
bindings. That would be a good place to start. And the Xapian Omega is
a pretty good introduction on how to make a web search (and could be
used behind the scenes without having a direct Lua binding).

Alternatively, SQLite's FTS3 module (aka Full Text Search) works rather nicely as well.

The next release of Nanoki provides full text search using SQLite's FTS3:

The API itself is rather straightforward as well and can be accessed directly from LuaSQL:

-- create a virtual table

create virtual table document using fts3
    tokenize porter

-- insert stuff into it

insert or ignore into document( name, content ) values( %s, %s )

-- query it

select as name,
            snippet( document, '<i>', '</i>', '…' ) as extract
from        [v:partition].document
where       document.content match %s
order by    1
limit       %s