diff --git a/tests/bands.tsv b/tests/bands.tsv new file mode 100644 index 0000000..74d3648 --- /dev/null +++ b/tests/bands.tsv @@ -0,0 +1,3 @@ +1 Led Zeppelin Some description. 35,23,16 5 +2 Daft Punk Some more strange description. 12 7 +3 Brainstorm No, not the Magic card. 1 9 diff --git a/ls-test.js b/tests/ls-test.js similarity index 100% rename from ls-test.js rename to tests/ls-test.js diff --git a/purels-opt.js b/tests/purels-opt.js similarity index 100% rename from purels-opt.js rename to tests/purels-opt.js diff --git a/purels.js b/tests/purels.js similarity index 79% rename from purels.js rename to tests/purels.js index e1ae5c1..1d514aa 100644 --- a/purels.js +++ b/tests/purels.js @@ -1,6 +1,6 @@ -var limestone = require("./limestone").SphinxClient(); +var limestone = require("../limestone").SphinxClient(); -var testString = 'test'; +var testString = 'Punk'; // 9312 is standard Sphinx port limestone.connect(9312, function(err) { @@ -10,7 +10,7 @@ limestone.connect(9312, function(err) { process.exit(); } console.log('Connected, sending query'); - limestone.query({'query':testString, maxmatches:1, 'fieldweights': {'name': 80, 'body': 30}}, function(err, answer) { + limestone.query({'query':testString, maxmatches:1, 'fieldweights': {'name': 80, 'desc': 30}}, function(err, answer) { limestone.disconnect(); console.log("Extended search for '" + testString + "' yielded " + answer.match_count + " results: " + JSON.stringify(answer)); }); diff --git a/tests/sphinx.conf b/tests/sphinx.conf new file mode 100644 index 0000000..1c657d5 --- /dev/null +++ b/tests/sphinx.conf @@ -0,0 +1,59 @@ +# +# Minimal Sphinx configuration sample (clean, simple, functional) +# +source tsv_test +{ + type = tsvpipe +} +source src1 +{ + type = tsvpipe + tsvpipe_command = cat D:\Source\Repos\limestone\tests\bands.tsv + tsvpipe_field = name + tsvpipe_field = desc + tsvpipe_attr_multi = genre_tags + tsvpipe_attr_uint = singer_id +} + + +index test1 +{ + source = src1 + path = D:\WORK\Sphinx\test +} + + +#index testrt +#{ +# type = rt +# rt_mem_limit = 128M +# +# path = @CONFDIR@/data/testrt +# +# rt_field = title +# rt_field = content +# rt_attr_uint = gid +#} + + +indexer +{ + mem_limit = 128M +} + + +searchd +{ + listen = 9312 + listen = 9306:mysql41 + log = D:\WORK\logs\searchd.log + query_log = D:\WORK\logs\sphinx-query.log + read_timeout = 5 + max_children = 30 + pid_file = D:\WORK\Sphinx\sphinx.pid + seamless_rotate = 1 + preopen_indexes = 1 + unlink_old = 1 + workers = threads # for RT to work + binlog_path = D:\WORK\Sphinx\data +} diff --git a/testfilters.js b/tests/testfilters.js similarity index 64% rename from testfilters.js rename to tests/testfilters.js index e8b6a0f..aa8a374 100644 --- a/testfilters.js +++ b/tests/testfilters.js @@ -1,29 +1,29 @@ -var limestone = require("./limestone").SphinxClient(); +var limestone = require("../limestone").SphinxClient(); // 9312 is standard Sphinx port // var filter = { 'type': 0, // VALUES - 'attr': 'author_id', - 'values':[1,4] + 'attr': 'singer_id', + 'values':[5,7] }; var filter_range = { 'type':1, // RANGE - 'attr':'author_id', - 'min':1, - 'max':3 + 'attr':'singer_id', + 'min':6, + 'max':10 } limestone.connect(9312, function(err) { if (!err) { - limestone.query({'query':'document', indices:'testpipe2', filters:[filter]}, function(err, answer){ + limestone.query({'query':'document', indices:'test1', filters:[filter]}, function(err, answer){ if (!err) { - console.log("Extended search for 'test' on authors 1 and 4 yielded " + answer.match_count + " results: " + JSON.stringify(answer)); + console.log("Extended search for 'test' on authors 5 and 7 yielded " + answer.match_count + " results: " + JSON.stringify(answer)); // limestone.disconnect(); - limestone.query({'query':'document', indices:'testpipe2', filters:[filter_range]}, function(err, answer){ + limestone.query({'query':'document', indices:'test1', filters:[filter_range]}, function(err, answer){ if (!err) { - console.log("Extended search for 'test' on authors 1..3 yielded " + answer.match_count + " results: " + JSON.stringify(answer)); + console.log("Extended search for 'test' on authors 6..10 yielded " + answer.match_count + " results: " + JSON.stringify(answer)); limestone.disconnect(); } else { console.log('Request 2 error: ' + err);