diff --git a/sphinx.conf b/sphinx.conf index 7e8e9c7..a61dce8 100644 --- a/sphinx.conf +++ b/sphinx.conf @@ -12,6 +12,7 @@ source files_index sql_db = btsearch sql_port = 3306 # optional, default is 3306 + sql_query_pre = REPLACE INTO sphinx_counter SELECT 1, MAX(fileid) FROM torrents sql_query = \ SELECT fls.fileid, fls.path, fls.size as filesize, \ torrents.hash as hash, torrents.name as name, torrents.size as size, \ @@ -33,7 +34,6 @@ source files_index sql_attr_string = contentCategory } - index files_index { source = files_index @@ -41,6 +41,23 @@ index files_index min_word_len = 3 } +source files_index_delta : files_index +{ + sql_query = \ + SELECT fls.fileid, fls.path, fls.size as filesize, \ + torrents.hash as hash, torrents.name as name, torrents.size as size, \ + torrents.seeders, torrents.leechers, torrents.completed, \ + torrents.files, torrents.contentType, torrents.contentCategory \ + FROM files as fls INNER JOIN torrents ON(torrents.hash = fls.hash) \ + WHERE fls.fileid > ( SELECT max_doc_id FROM sphinx_counter WHERE counter_id = 1 ) +} + +index files_index_delta : files_index +{ + source = files_index_delta + path = /var/data/files.delta +} + source torrents_index { type = mysql @@ -51,6 +68,7 @@ source torrents_index sql_db = btsearch sql_port = 3306 # optional, default is 3306 + sql_query_pre = REPLACE INTO sphinx_counter SELECT 2, MAX(torrentid) FROM torrents sql_query = \ SELECT torrents.torrentid, torrents.hash as hash, torrents.name as name, torrents.size as size, \ torrents.seeders, torrents.leechers, torrents.completed, \ @@ -68,7 +86,6 @@ source torrents_index sql_attr_string = contentCategory } - index torrents_index { source = torrents_index @@ -76,6 +93,23 @@ index torrents_index min_word_len = 3 } +source torrents_index_delta : torrents_index +{ + sql_query = \ + SELECT torrents.torrentid, torrents.hash as hash, torrents.name as name, torrents.size as size, \ + torrents.seeders, torrents.leechers, torrents.completed, \ + torrents.files, torrents.contentType, torrents.contentCategory \ + FROM torrents \ + WHERE torrents.torrentid > ( SELECT max_doc_id FROM sphinx_counter WHERE counter_id = 2 ) +} + +index torrents_index_delta : torrents_index +{ + source = torrents_index_delta + path = /var/data/torrents.delta +} + + indexer {