Reputation: 2993
I have total 720 sphinx index with 1.21 GB size. Here attached all index with one service. it takes 800MB of RAM. I have used sql_attr_str2ordinal for storing string so RAM is reduced and now it takes 17MB only. but the problem here is the search result give 0 matches.Search is applied using java api from sphinx index. Conf file and java code are as following:
searchd{
listen = 516
log = D:\programs\spinx\spinxexperiment\project\log\searchd.log
query_log = D:\programs\spinx\spinxexperiment\project\log\query.log
read_timeout = 5
max_children = 30
pid_file = D:\programs\spinx\spinxexperiment\project\log\searchd.pid
max_matches = 1000
seamless_rotate = 0
preopen_indexes = 0
unlink_old = 1
ondisk_dict_default = 1
mva_updates_pool = 1M
workers = threads # for RT to work}
source webusagedatagroup20120301{
type = pgsql
sql_host = 127.0.0.1
sql_user = postgres
sql_pass =
sql_db = iviewdb
sql_port = 5432
sql_query = SELECT id,username as username_ord,domain as domain_ord,application,hits,bytes from webusagedata1
sql_attr_str2ordinal = username_ord
sql_attr_str2ordinal = domain_ord
sql_attr_str2ordinal = application
sql_attr_bigint = hits
sql_attr_bigint = bytes}
index webusagedatagroup20120301{
source = webusagedatagroup20120301
path = D:\programs\spinx\spinxexperiment\project\data\20120301\group\webusagedatagroup20120301
preopen = 0
docinfo = inline
ondisk_dict = 1
charset_type = sbcs
rt_field = username
rt_field = domain
rt_field = application
rt_attr_bigint = hits
rt_attr_bigint = bytes}
code:
client = new SphinxClient("127.0.0.1",516);
client.SetMatchMode(SphinxClient.SPH_MATCH_PHRASE);
query=prepareQuery();
client.SetLimits(0, 20);
client.SetMaxQueryTime(0);
client.SetConnectTimeout(60000);
client.SetSelect("*, SUM(bytes) as bytes_total");
client.SetGroupBy("application", SphinxClient.SPH_GROUPBY_ATTR,"username asc");
SphinxResult res = client.Query("divyesh.modi", "webusagedatagroup20120130");
Upvotes: 0
Views: 684
Reputation: 21091
As discussed over on the sphinx forum. A index needs a field(s) to work. Your index has no fields, so will be ineffective.
As you seem to want to be able to search by username, need to make the username both a field AND a ordinaal attribute (so you can do group by without having to use string attributes)
You need to note the columns twice in sql_query, once for the field, once for the attribute.
Upvotes: 0