diff options
author | Eric Wong <e@80x24.org> | 2024-04-24 06:44:45 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2024-04-24 21:34:46 +0000 |
commit | 8e4426e3ff9e3dde861d4722b73b5a21c42910d4 (patch) | |
tree | 8140d1a666bdb2504640c66d510c0d2bc1b2af05 /lib/PublicInbox | |
parent | 5aa2ba6d74c3f6a7f62a091e5df8346bb6d5b35a (diff) | |
download | public-inbox-8e4426e3ff9e3dde861d4722b73b5a21c42910d4.tar.gz |
Retrieving Xapian document terms, data (and possibly values) and transferring to the Perl side would be an increase in complexity and I/O both the Perl and C++ sides. It would require more I/O in C++ and transient memory use on the Perl side where slow mset iteration gives an opportunity to dictate memory release rate. So lets ignore the document-related stuff here for now for ease-of-development. We can reconsider this change if dropping Xapian Perl bindings entirely and relying on JAOT C++ ever becomes a possibility.
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r-- | lib/PublicInbox/Search.pm | 1 | ||||
-rw-r--r-- | lib/PublicInbox/XapHelper.pm | 5 | ||||
-rw-r--r-- | lib/PublicInbox/xap_helper.h | 2 | ||||
-rw-r--r-- | lib/PublicInbox/xh_mset.h | 24 |
4 files changed, 0 insertions, 32 deletions
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index 678c8c5d..0196dd45 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -89,7 +89,6 @@ our @XH_SPEC = ( 'r', # 1=relevance then column 't', # collapse threads 'A=s@', # prefixes - 'D', # emit docdata 'K=i', # timeout kill after i seconds 'O=s', # eidx_key 'T=i', # threadid diff --git a/lib/PublicInbox/XapHelper.pm b/lib/PublicInbox/XapHelper.pm index 8c7732f5..27d98ba1 100644 --- a/lib/PublicInbox/XapHelper.pm +++ b/lib/PublicInbox/XapHelper.pm @@ -150,11 +150,6 @@ sub mset_iter ($$) { eval { my $buf = $it->get_docid; $buf .= "\0".$it->get_percent if $req->{p}; - my $doc = ($req->{A} || $req->{D}) ? $it->get_document : undef; - for my $p (@{$req->{A}}) { - $buf .= "\0".$p.$_ for xap_terms($p, $doc); - } - $buf .= "\0".$doc->get_data if $req->{D}; say { $req->{0} } $buf; }; $@ ? iter_retry_check($req) : 0; diff --git a/lib/PublicInbox/xap_helper.h b/lib/PublicInbox/xap_helper.h index 0e6805b3..872f063d 100644 --- a/lib/PublicInbox/xap_helper.h +++ b/lib/PublicInbox/xap_helper.h @@ -142,7 +142,6 @@ struct req { // argv and pfxv point into global rbuf bool code_search; bool relevance; // sort by relevance before column bool emit_percent; - bool emit_docdata; bool asc; // ascending sort }; @@ -641,7 +640,6 @@ static void dispatch(struct req *req) if (MY_ARG_MAX == req->pfxc) ABORT("too many -A"); break; - case 'D': req->emit_docdata = true; break; case 'K': req->timeout_sec = strtoul(optarg, &end, 10); if (*end || req->timeout_sec == ULONG_MAX) diff --git a/lib/PublicInbox/xh_mset.h b/lib/PublicInbox/xh_mset.h index 4e97a284..3727a932 100644 --- a/lib/PublicInbox/xh_mset.h +++ b/lib/PublicInbox/xh_mset.h @@ -3,20 +3,6 @@ // This file is only intended to be included by xap_helper.h // it implements pieces used by WWW, IMAP and lei -static void emit_doc_term(FILE *fp, const char *pfx, Xapian::Document *doc) -{ - Xapian::TermIterator cur = doc->termlist_begin(); - Xapian::TermIterator end = doc->termlist_end(); - size_t pfx_len = strlen(pfx); - - for (cur.skip_to(pfx); cur != end; cur++) { - std::string tn = *cur; - if (!starts_with(&tn, pfx, pfx_len)) break; - fputc(0, fp); - fwrite(tn.data(), tn.size(), 1, fp); - } -} - static enum exc_iter mset_iter(const struct req *req, FILE *fp, off_t off, Xapian::MSetIterator *i) { @@ -24,16 +10,6 @@ static enum exc_iter mset_iter(const struct req *req, FILE *fp, off_t off, fprintf(fp, "%llu", (unsigned long long)(*(*i))); // get_docid if (req->emit_percent) fprintf(fp, "%c%d", 0, i->get_percent()); - if (req->pfxc || req->emit_docdata) { - Xapian::Document doc = i->get_document(); - for (int p = 0; p < req->pfxc; p++) - emit_doc_term(fp, req->pfxv[p], &doc); - if (req->emit_docdata) { - std::string d = doc.get_data(); - fputc(0, fp); - fwrite(d.data(), d.size(), 1, fp); - } - } fputc('\n', fp); } catch (const Xapian::DatabaseModifiedError & e) { req->srch->db->reopen(); |