139 |
const char *g_uigsuffix = NULL; /* suffix added to the global URI of each document */ |
const char *g_uigsuffix = NULL; /* suffix added to the global URI of each document */ |
140 |
const char *g_uidirindex = NULL; /* name of the directory index file */ |
const char *g_uidirindex = NULL; /* name of the directory index file */ |
141 |
CBLIST *g_uireplaces = NULL; /* expressions to replace the URI of each document */ |
CBLIST *g_uireplaces = NULL; /* expressions to replace the URI of each document */ |
|
CBLIST *g_uicondattrs = NULL; /* attributes for search condition */ |
|
142 |
CBLIST *g_uiextattrs = NULL; /* extra attributes to be shown */ |
CBLIST *g_uiextattrs = NULL; /* extra attributes to be shown */ |
143 |
|
int g_uismplphrase = FALSE; /* whether to use simplefied search phrase */ |
144 |
int g_bgmode = FALSE; /* whether to be foreground mode */ |
int g_bgmode = FALSE; /* whether to be foreground mode */ |
145 |
int g_stmode = FALSE; /* whether to be single thread mode */ |
int g_stmode = FALSE; /* whether to be single thread mode */ |
146 |
DEPOT *g_metadb = NULL; /* meta database */ |
DEPOT *g_metadb = NULL; /* meta database */ |
402 |
struct stat sbuf; |
struct stat sbuf; |
403 |
const char *rp, *name; |
const char *rp, *name; |
404 |
char path[URIBUFSIZ], numbuf[NUMBUFSIZ]; |
char path[URIBUFSIZ], numbuf[NUMBUFSIZ]; |
405 |
int i, j, pid, omode; |
int i, pid, omode; |
406 |
if(stat(g_rootdir, &sbuf) == -1) |
if(stat(g_rootdir, &sbuf) == -1) |
407 |
die("the server root directory (%s) could not open", g_rootdir); |
die("the server root directory (%s) could not open", g_rootdir); |
408 |
sprintf(path, "%s%c%s", g_rootdir, ESTPATHCHR, CONFFILE); |
sprintf(path, "%s%c%s", g_rootdir, ESTPATHCHR, CONFFILE); |
412 |
cbglobalgc(g_trustednodes, (void (*)(void *))cbmapclose); |
cbglobalgc(g_trustednodes, (void (*)(void *))cbmapclose); |
413 |
g_uireplaces = cblistopen(); |
g_uireplaces = cblistopen(); |
414 |
cbglobalgc(g_uireplaces, (void (*)(void *))cblistclose); |
cbglobalgc(g_uireplaces, (void (*)(void *))cblistclose); |
|
g_uicondattrs = cblistopen(); |
|
|
cbglobalgc(g_uicondattrs, (void (*)(void *))cblistclose); |
|
415 |
g_uiextattrs = cblistopen(); |
g_uiextattrs = cblistopen(); |
416 |
cbglobalgc(g_uiextattrs, (void (*)(void *))cblistclose); |
cbglobalgc(g_uiextattrs, (void (*)(void *))cblistclose); |
417 |
for(i = 0; i < cblistnum(lines); i++){ |
for(i = 0; i < cblistnum(lines); i++){ |
442 |
g_docroot = skiplabel(rp); |
g_docroot = skiplabel(rp); |
443 |
} else if(cbstrfwimatch(rp, "indexfile:")){ |
} else if(cbstrfwimatch(rp, "indexfile:")){ |
444 |
g_indexfile = skiplabel(rp); |
g_indexfile = skiplabel(rp); |
445 |
} else if(cbstrfwimatch(rp, "trustednodes:")){ |
} else if(cbstrfwimatch(rp, "trustednode:")){ |
446 |
elems = cbsplit(skiplabel(rp), -1, " ,"); |
cbmapput(g_trustednodes, skiplabel(rp), -1, "", 0, TRUE); |
|
for(j = 0; j < cblistnum(elems); j++){ |
|
|
rp = cblistval(elems, j, NULL); |
|
|
if(rp != '\0') cbmapput(g_trustednodes, rp, -1, "", 0, TRUE); |
|
|
} |
|
|
cblistclose(elems); |
|
447 |
} else if(cbstrfwimatch(rp, "denyuntrusted:")){ |
} else if(cbstrfwimatch(rp, "denyuntrusted:")){ |
448 |
g_denyuntrusted = atoi(skiplabel(rp)) > 0; |
g_denyuntrusted = atoi(skiplabel(rp)) > 0; |
449 |
} else if(cbstrfwimatch(rp, "cachesize:")){ |
} else if(cbstrfwimatch(rp, "cachesize:")){ |
466 |
g_uidirindex = skiplabel(rp); |
g_uidirindex = skiplabel(rp); |
467 |
} else if(cbstrfwimatch(rp, "uireplace:")){ |
} else if(cbstrfwimatch(rp, "uireplace:")){ |
468 |
cblistpush(g_uireplaces, skiplabel(rp), -1); |
cblistpush(g_uireplaces, skiplabel(rp), -1); |
|
} else if(cbstrfwimatch(rp, "uicondattr:")){ |
|
|
cblistpush(g_uicondattrs, skiplabel(rp), -1); |
|
469 |
} else if(cbstrfwimatch(rp, "uiextattr:")){ |
} else if(cbstrfwimatch(rp, "uiextattr:")){ |
470 |
cblistpush(g_uiextattrs, skiplabel(rp), -1); |
cblistpush(g_uiextattrs, skiplabel(rp), -1); |
471 |
|
} else if(cbstrfwimatch(rp, "uismplphrase:")){ |
472 |
|
g_uismplphrase = atoi(skiplabel(rp)) > 0; |
473 |
} |
} |
474 |
} |
} |
475 |
if(!g_hostname) die("hostname is undefined"); |
if(!g_hostname) die("hostname is undefined"); |
1908 |
cond = est_cond_new(); |
cond = est_cond_new(); |
1909 |
max = DEFMAXSRCH; |
max = DEFMAXSRCH; |
1910 |
depth = 0; |
depth = 0; |
1911 |
if((tmp = cbmapget(req->params, "phrase", -1, NULL)) != NULL) est_cond_set_phrase(cond, tmp); |
if((tmp = cbmapget(req->params, "phrase", -1, NULL)) != NULL && tmp[0] != '\0') |
1912 |
if((tmp = cbmapget(req->params, "attr", -1, NULL)) != NULL) est_cond_set_phrase(cond, tmp); |
est_cond_set_phrase(cond, tmp); |
1913 |
if((tmp = cbmapget(req->params, "attr1", -1, NULL)) != NULL) est_cond_add_attr(cond, tmp); |
if((tmp = cbmapget(req->params, "attr", -1, NULL)) != NULL && tmp[0] != '\0') |
1914 |
if((tmp = cbmapget(req->params, "attr2", -1, NULL)) != NULL) est_cond_add_attr(cond, tmp); |
est_cond_set_phrase(cond, tmp); |
1915 |
if((tmp = cbmapget(req->params, "attr3", -1, NULL)) != NULL) est_cond_add_attr(cond, tmp); |
if((tmp = cbmapget(req->params, "attr1", -1, NULL)) != NULL && tmp[0] != '\0') |
1916 |
if((tmp = cbmapget(req->params, "attr4", -1, NULL)) != NULL) est_cond_add_attr(cond, tmp); |
est_cond_add_attr(cond, tmp); |
1917 |
if((tmp = cbmapget(req->params, "attr5", -1, NULL)) != NULL) est_cond_add_attr(cond, tmp); |
if((tmp = cbmapget(req->params, "attr2", -1, NULL)) != NULL && tmp[0] != '\0') |
1918 |
if((tmp = cbmapget(req->params, "attr6", -1, NULL)) != NULL) est_cond_add_attr(cond, tmp); |
est_cond_add_attr(cond, tmp); |
1919 |
if((tmp = cbmapget(req->params, "attr7", -1, NULL)) != NULL) est_cond_add_attr(cond, tmp); |
if((tmp = cbmapget(req->params, "attr3", -1, NULL)) != NULL && tmp[0] != '\0') |
1920 |
if((tmp = cbmapget(req->params, "attr8", -1, NULL)) != NULL) est_cond_add_attr(cond, tmp); |
est_cond_add_attr(cond, tmp); |
1921 |
if((tmp = cbmapget(req->params, "attr9", -1, NULL)) != NULL) est_cond_add_attr(cond, tmp); |
if((tmp = cbmapget(req->params, "attr4", -1, NULL)) != NULL && tmp[0] != '\0') |
1922 |
if((tmp = cbmapget(req->params, "order", -1, NULL)) != NULL) est_cond_set_order(cond, tmp); |
est_cond_add_attr(cond, tmp); |
1923 |
|
if((tmp = cbmapget(req->params, "attr5", -1, NULL)) != NULL && tmp[0] != '\0') |
1924 |
|
est_cond_add_attr(cond, tmp); |
1925 |
|
if((tmp = cbmapget(req->params, "attr6", -1, NULL)) != NULL && tmp[0] != '\0') |
1926 |
|
est_cond_add_attr(cond, tmp); |
1927 |
|
if((tmp = cbmapget(req->params, "attr7", -1, NULL)) != NULL && tmp[0] != '\0') |
1928 |
|
est_cond_add_attr(cond, tmp); |
1929 |
|
if((tmp = cbmapget(req->params, "attr8", -1, NULL)) != NULL && tmp[0] != '\0') |
1930 |
|
est_cond_add_attr(cond, tmp); |
1931 |
|
if((tmp = cbmapget(req->params, "attr9", -1, NULL)) != NULL && tmp[0] != '\0') |
1932 |
|
est_cond_add_attr(cond, tmp); |
1933 |
|
if((tmp = cbmapget(req->params, "order", -1, NULL)) != NULL && tmp[0] != '\0') |
1934 |
|
est_cond_set_order(cond, tmp); |
1935 |
if((tmp = cbmapget(req->params, "max", -1, NULL)) && (num = atoi(tmp)) >= 0) max = num; |
if((tmp = cbmapget(req->params, "max", -1, NULL)) && (num = atoi(tmp)) >= 0) max = num; |
1936 |
est_cond_set_max(cond, max + 1); |
est_cond_set_max(cond, max + 1); |
1937 |
if((tmp = cbmapget(req->params, "options", -1, NULL)) && (num = atoi(tmp)) > 0) |
if((tmp = cbmapget(req->params, "options", -1, NULL)) && (num = atoi(tmp)) > 0) |
2341 |
depth = 0; |
depth = 0; |
2342 |
page = 0; |
page = 0; |
2343 |
if((tmp = cbmapget(req->params, "page", -1, NULL)) && (num = atoi(tmp)) > 0) page = num; |
if((tmp = cbmapget(req->params, "page", -1, NULL)) && (num = atoi(tmp)) > 0) page = num; |
2344 |
if((tmp = cbmapget(req->params, "phrase", -1, NULL)) != NULL) est_cond_set_phrase(cond, tmp); |
if((tmp = cbmapget(req->params, "phrase", -1, NULL)) != NULL && tmp[0] != '\0') |
2345 |
if((tmp = cbmapget(req->params, "attr", -1, NULL)) != NULL) est_cond_set_phrase(cond, tmp); |
est_cond_set_phrase(cond, tmp); |
2346 |
if((tmp = cbmapget(req->params, "attr1", -1, NULL)) != NULL) est_cond_add_attr(cond, tmp); |
if((tmp = cbmapget(req->params, "attr", -1, NULL)) != NULL && tmp[0] != '\0') |
2347 |
if((tmp = cbmapget(req->params, "attr2", -1, NULL)) != NULL) est_cond_add_attr(cond, tmp); |
est_cond_set_phrase(cond, tmp); |
2348 |
if((tmp = cbmapget(req->params, "attr3", -1, NULL)) != NULL) est_cond_add_attr(cond, tmp); |
if((tmp = cbmapget(req->params, "attr1", -1, NULL)) != NULL && tmp[0] != '\0') |
2349 |
if((tmp = cbmapget(req->params, "order", -1, NULL)) != NULL) est_cond_set_order(cond, tmp); |
est_cond_add_attr(cond, tmp); |
2350 |
|
if((tmp = cbmapget(req->params, "attr2", -1, NULL)) != NULL && tmp[0] != '\0') |
2351 |
|
est_cond_add_attr(cond, tmp); |
2352 |
|
if((tmp = cbmapget(req->params, "attr3", -1, NULL)) != NULL && tmp[0] != '\0') |
2353 |
|
est_cond_add_attr(cond, tmp); |
2354 |
|
if((tmp = cbmapget(req->params, "order", -1, NULL)) != NULL && tmp[0] != '\0') |
2355 |
|
est_cond_set_order(cond, tmp); |
2356 |
if((tmp = cbmapget(req->params, "max", -1, NULL)) && (num = atoi(tmp)) >= 0) max = num; |
if((tmp = cbmapget(req->params, "max", -1, NULL)) && (num = atoi(tmp)) >= 0) max = num; |
2357 |
est_cond_set_max(cond, max + page * max + 1); |
est_cond_set_max(cond, max + page * max + 1); |
2358 |
if((tmp = cbmapget(req->params, "depth", -1, NULL)) && (num = atoi(tmp)) > 0) depth = num; |
if((tmp = cbmapget(req->params, "depth", -1, NULL)) && (num = atoi(tmp)) > 0) depth = num; |
2359 |
if(depth >= g_searchdepth) depth = g_searchdepth; |
if(depth >= g_searchdepth) depth = g_searchdepth; |
2360 |
|
if(g_uismplphrase) est_cond_set_options(cond, ESTCONDSIMPLE); |
2361 |
top = !est_cond_phrase(cond) && !est_cond_attrs(cond); |
top = !est_cond_phrase(cond) && !est_cond_attrs(cond); |
2362 |
phrase = est_cond_phrase(cond); |
phrase = est_cond_phrase(cond); |
2363 |
attrs = est_cond_attrs(cond); |
attrs = est_cond_attrs(cond); |
3033 |
for(i = 0; i < cblistnum(list); i++){ |
for(i = 0; i < cblistnum(list); i++){ |
3034 |
if(!(tmp = cblistval(list, i, NULL)) || !(tnode = nmgr_get(g_nmgr, tmp))) continue; |
if(!(tmp = cblistval(list, i, NULL)) || !(tnode = nmgr_get(g_nmgr, tmp))) continue; |
3035 |
est_datum_printf(datum, "<tr>\n"); |
est_datum_printf(datum, "<tr>\n"); |
3036 |
est_datum_printf(datum, "<td>%@</td>\n", tnode->name); |
est_datum_printf(datum, "<td><a href=\"%@%@/searchui\">%@</a></td>\n", |
3037 |
|
NODEPREFIX, tnode->name, tnode->name); |
3038 |
est_datum_printf(datum, "<td>%@</td>\n", tnode->label); |
est_datum_printf(datum, "<td>%@</td>\n", tnode->label); |
3039 |
est_datum_printf(datum, "<td>%d</td>\n", est_mtdb_doc_num(tnode->db)); |
est_datum_printf(datum, "<td>%d</td>\n", est_mtdb_doc_num(tnode->db)); |
3040 |
est_datum_printf(datum, "<td>%d</td>\n", est_mtdb_word_num(tnode->db)); |
est_datum_printf(datum, "<td>%d</td>\n", est_mtdb_word_num(tnode->db)); |