¿porqué?
• gran
velocidad
de
búsqueda
• escalabilidad
• no
solo
indexa
textos
(atributos
numericos
para
filtrar)
• puede
trabajar
como
reemplazo
de
mysql
para
ordenar
y
agrupar
• selección
de
operadores
y
“matching
modes”
dos
programas
• indexer
consulta
la
BD,
crea
índices.
• searchd
usa
los
índices
para
responder
consultas
de
clientes.
programas
cliente
– API
NATIVA
php,
python,
ruby,
java…
– SphinxSE
Mysql
Engine
facts
• standalone
• no
es
específico
para
MySQL
• no
actualiza
los
índices
solo
• sphinx
solo
devuelve
ids
• permite
ordenar
por
relevancia
• exact
search
/
boolean
search
/
…
• API
en
varios
lenguajes
• implementa
protocolo
MySQL
source
user_timelines
:
base
{
sql_query_pre
=
SELECT
@tt_id:=id
FROM
`tweets_timelines`
WHERE
`created`
<=
DATE_SUB(CURDATE(),INTERVAL
8
DAY)
ORDER
BY
created
DESC
LIMIT
1
sql_query_pre
=
REPLACE
INTO
sph_counter
SET
counter_id
=
"user_timelines",
modif=NOW(),
max_doc_id
=
(
SELECT
MAX(id)
max
FROM
tweets_timelines),
last_doc_id
=
max_doc_id
sql_query
=
SELECT
tt.id,
tt.twitter_id,
tt.tweets_id,
lm.id
AS
link_id,
lm.expanded_link,
lm.title,
lm.description,
lm.body,
lm.tld_id,
lm.extracted,
UNIX_TIMESTAMP(tt.created)
AS
created_stamp
FROM
links_metadata
lm,
tweets_timelines
tt
WHERE
tt.id
>=
@tt_id
AND
lm.extracted
=
1
AND
tt.links_id
=
lm.id
AND
tt.id
<=
(SELECT
max_doc_id
FROM
sph_counter
WHERE
counter_id="user_timelines")