mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Full-text search: Print links to non main-namespace pages
This commit is contained in:
parent
cc8c120982
commit
96d1299273
@ -29,7 +29,6 @@ class Xofulltext_highlighter_mgr implements Gfo_invk {
|
||||
private final Gflucene_searcher_qry searcher_data;
|
||||
private final Gflucene_highlighter_mgr highlighter_mgr = new Gflucene_highlighter_mgr();
|
||||
private final Xoh_page hpg = new Xoh_page();
|
||||
private final Xowd_page_itm tmp_page_row = new Xowd_page_itm();
|
||||
private final Ordered_hash list;
|
||||
private final Xofulltext_extractor extractor = new Xofulltext_extractor();
|
||||
public Xofulltext_highlighter_mgr(Xofulltext_searcher_ui ui, Xow_wiki wiki, Xofulltext_searcher_args searcher_args, Gflucene_analyzer_data analyzer_data, Gflucene_searcher_qry searcher_data, Ordered_hash list) {
|
||||
@ -59,15 +58,9 @@ class Xofulltext_highlighter_mgr implements Gfo_invk {
|
||||
highlighter_mgr.Term();
|
||||
}
|
||||
private void Highlight_item(Gflucene_doc_data item) {
|
||||
// load db.core.page
|
||||
if (!wiki.Data__core_mgr().Db__core().Tbl__page().Select_by_id(tmp_page_row, item.page_id)) {
|
||||
Gfo_usr_dlg_.Instance.Warn_many("", "", "search.highlight: could not find page; page_id=~{0}", item.page_id);
|
||||
return;
|
||||
}
|
||||
|
||||
// init hpg
|
||||
Xoa_ttl page_ttl = wiki.Ttl_parse(tmp_page_row.Ns_id(), tmp_page_row.Ttl_page_db());
|
||||
Xoa_url page_url = wiki.Utl__url_parser().Parse(page_ttl.Page_db());
|
||||
Xoa_ttl page_ttl = wiki.Ttl_parse(item.page_full_db);
|
||||
Xoa_url page_url = wiki.Utl__url_parser().Parse(page_ttl.Full_db());
|
||||
hpg.Ctor_by_hview(wiki, page_url, page_ttl, item.page_id);
|
||||
|
||||
// load db.html.html
|
||||
|
@ -19,6 +19,7 @@ import gplx.gflucene.core.*;
|
||||
import gplx.gflucene.indexers.*;
|
||||
import gplx.gflucene.searchers.*;
|
||||
import gplx.gflucene.highlighters.*;
|
||||
import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.addons.wikis.fulltexts.searchers.mgrs.uis.*;
|
||||
public class Xofulltext_searcher__lucene implements Xofulltext_searcher {
|
||||
private final Gflucene_searcher_mgr searcher = new Gflucene_searcher_mgr();
|
||||
@ -39,13 +40,28 @@ public class Xofulltext_searcher__lucene implements Xofulltext_searcher {
|
||||
// term
|
||||
searcher.Term();
|
||||
|
||||
// loop list and send pages
|
||||
// get page_load vars
|
||||
Xowd_page_itm tmp_page_row = new Xowd_page_itm();
|
||||
Xowd_page_tbl page_tbl = wiki.Data__core_mgr().Db__core().Tbl__page();
|
||||
|
||||
// loop list and load pages
|
||||
int len = list.Len();
|
||||
for (int i = 0; i < len; i++) {
|
||||
Gflucene_doc_data found = (Gflucene_doc_data)list.Get_at(i);
|
||||
Gflucene_doc_data doc_data = (Gflucene_doc_data)list.Get_at(i);
|
||||
|
||||
// call page found
|
||||
Xofulltext_searcher_page page = new Xofulltext_searcher_page(args.query_id, wiki.Domain_str(), found.page_id, found.title, args.expand_matches_section);
|
||||
// load page
|
||||
if (!page_tbl.Select_by_id(tmp_page_row, doc_data.page_id)) {
|
||||
Gfo_usr_dlg_.Instance.Warn_many("", "", "searcher.lucene: could not find page; page_id=~{0}", doc_data.page_id);
|
||||
continue;
|
||||
}
|
||||
|
||||
// make page_ttl
|
||||
Xoa_ttl page_ttl = wiki.Ttl_parse(tmp_page_row.Ns_id(), tmp_page_row.Ttl_page_db());
|
||||
doc_data.ns_id = tmp_page_row.Ns_id();
|
||||
doc_data.page_full_db = page_ttl.Full_db();
|
||||
|
||||
// call page doc_data
|
||||
Xofulltext_searcher_page page = new Xofulltext_searcher_page(args.query_id, wiki.Domain_str(), doc_data.page_id, String_.new_u8(doc_data.page_full_db), args.expand_matches_section);
|
||||
ui.Send_page_add(page);
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,9 @@ package gplx.gflucene.core; import gplx.*; import gplx.gflucene.*;
|
||||
public class Gflucene_doc_data {
|
||||
public String title;
|
||||
public String body;
|
||||
public int ns_id;
|
||||
public int page_id;
|
||||
public byte[] page_full_db;
|
||||
public int score;
|
||||
public float lucene_score = 0;
|
||||
public Gflucene_doc_data(int page_id, int score, String title, String body) {
|
||||
|
Loading…
Reference in New Issue
Block a user