1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2025-06-02 07:24:19 +00:00

Full-text search: Add expand_pages

This commit is contained in:
gnosygnu 2017-03-27 16:58:57 -04:00
parent 968e8917c2
commit c964eedd58
5 changed files with 10 additions and 5 deletions

View File

@ -57,6 +57,7 @@ public class Xofulltext_args_qry {
Set_prop(wiki_args, wikis_len, args, "ns_ids");
Set_prop(wiki_args, wikis_len, args, "offsets");
Set_prop(wiki_args, wikis_len, args, "limits");
Set_prop(wiki_args, wikis_len, args, "expand_pages");
Set_prop(wiki_args, wikis_len, args, "expand_snips");
Set_prop(wiki_args, wikis_len, args, "show_all_snips");

View File

@ -21,6 +21,7 @@ public class Xofulltext_args_wiki {
public int bgn;
public int len;
public int end() {return bgn + len;}
public boolean expand_pages;
public boolean expand_snips;
public boolean show_all_snips;
@ -38,6 +39,7 @@ public class Xofulltext_args_wiki {
}
else if (String_.Eq(key, "offsets")) this.bgn = Bry_.To_int(val);
else if (String_.Eq(key, "limits")) this.len = Bry_.To_int(val);
else if (String_.Eq(key, "expand_pages")) this.expand_pages = Bry_.Eq(val, Bool_.Y_bry);
else if (String_.Eq(key, "expand_snips")) this.expand_snips = Bry_.Eq(val, Bool_.Y_bry);
else if (String_.Eq(key, "show_all_snips")) this.show_all_snips = Bry_.Eq(val, Bool_.Y_bry);
}

View File

@ -25,10 +25,11 @@ public class Xofulltext_searcher_ui {
this.cbk_mgr = cbk_mgr;
this.cbk_trg = cbk_trg;
}
public void Send_wiki_add(boolean type_is_lucene, byte[] wiki, int rng_bgn, int rng_end) {
public void Send_wiki_add(boolean type_is_lucene, boolean expand_pages, byte[] wiki, int rng_bgn, int rng_end) {
cbk_mgr.Send_json(cbk_trg, "xo.fulltext_searcher.results__wiki__add__recv", gplx.core.gfobjs.Gfobj_nde.New()
.Add_bry("wiki", wiki)
.Add_bool("type_is_lucene", type_is_lucene)
.Add_bool("expand_pages", expand_pages)
.Add_int("rng_bgn", rng_bgn + List_adp_.Base1)
.Add_int("rng_end", rng_end)
);
@ -50,12 +51,12 @@ public class Xofulltext_searcher_ui {
);
cache_mgr.Add_page(page.Query_id(), page.Wiki_domain(), page.Page_id(), page.Page_ttl());
}
public void Send_line_add(boolean add_to_cache, boolean show_all_matches, int qry_id, byte[] wiki_domain, int page_id, int line_sort_order, byte[] line_html) {
public void Send_line_add(boolean add_to_cache, boolean show_all_snips, int qry_id, byte[] wiki_domain, int page_id, int line_sort_order, byte[] line_html) {
if (add_to_cache)
cache_mgr.Add_line(qry_id, wiki_domain, page_id, line_sort_order, line_html);
line_sort_order += List_adp_.Base1; // NOTE: increment after cache_mgr
if (line_sort_order == 1 || show_all_matches) {
if (line_sort_order == 1 || show_all_snips) {
cbk_mgr.Send_json(cbk_trg, "xo.fulltext_searcher.results__line__add__recv", gplx.core.gfobjs.Gfobj_nde.New()
.Add_bry("wiki", wiki_domain)
.Add_int("page_id", page_id)
@ -67,7 +68,7 @@ public class Xofulltext_searcher_ui {
.Add_bry("wiki", wiki_domain)
.Add_int("page_id", page_id)
.Add_int("found", line_sort_order)
.Add_bool("show_all_matches", show_all_matches)
.Add_bool("show_all_snips", show_all_snips)
);
}
public void Send_done() {

View File

@ -30,6 +30,7 @@ class Xofulltext_searcher_html extends Xow_special_wtr__base implements Mustache
props_Add_str(cfg_mgr, url_args, "ns_ids", "0");
props_Add_str(cfg_mgr, url_args, "limits", "25");
props_Add_str(cfg_mgr, url_args, "offsets", "0");
props_Add_str(cfg_mgr, url_args, "expand_pages", "n");
props_Add_str(cfg_mgr, url_args, "expand_snips", "n");
props_Add_str(cfg_mgr, url_args, "show_all_snips", "n");

View File

@ -83,7 +83,7 @@ class Xofulltext_searcher_svc implements Gfo_invk {
byte[] wiki_domain = wiki_args.wiki;
Xow_wiki wiki = app.Wiki_mgri().Get_by_or_make_init_y(wiki_domain);
Xofulltext_searcher searcher = Get_searcher(wiki);
ui.Send_wiki_add(searcher.Type_is_lucene(), wiki_domain, wiki_args.bgn, wiki_args.end());
ui.Send_wiki_add(searcher.Type_is_lucene(), wiki_args.expand_pages, wiki_domain, wiki_args.bgn, wiki_args.end());
// try to get from cache
byte[] qry_key = args.Qry_key(wiki_domain, wiki_args.ns_ids);