From 9a1bfc6980fb492149ad795330f0d5b17a3b59cf Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sat, 15 Feb 2020 19:25:30 +0530 Subject: First commit. --- xapian/wrap.scm | 902 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ xapian/xapian.scm | 124 ++++++++ 2 files changed, 1026 insertions(+) create mode 100644 xapian/wrap.scm create mode 100644 xapian/xapian.scm (limited to 'xapian') diff --git a/xapian/wrap.scm b/xapian/wrap.scm new file mode 100644 index 0000000..be4039c --- /dev/null +++ b/xapian/wrap.scm @@ -0,0 +1,902 @@ +;;; This file was automatically generated by SWIG (http://www.swig.org). +;;; Version 3.0.12 +;;; +;;; Do not make changes to this file unless you know what you are doing--modify +;;; the SWIG interface file instead. + +(define-module (xapian wrap)) + + +(load-extension "./libguilexapian" "SWIG_init") + + +(export version-string + major-version + minor-version + revision + BAD-VALUENO + DB-CREATE + DB-CREATE-OR-OPEN + DB-CREATE-OR-OVERWRITE + DB-OPEN + DB-NO-SYNC + DB-FULL-SYNC + DB-DANGEROUS + DB-NO-TERMLIST + DB-BACKEND-CHERT + DB-BACKEND-GLASS + DB-BACKEND-INMEMORY + DB-BACKEND-STUB + DB-RETRY-LOCK + DBCHECK-SHORT-TREE + DBCHECK-FULL-TREE + DBCHECK-SHOW-FREELIST + DBCHECK-SHOW-STATS + DBCHECK-FIX + DBCOMPACT-MULTIPASS + DBCOMPACT-NO-RENUMBER + DBCOMPACT-SINGLE-FILE + DOC-ASSUME-VALID + new-PositionIterator + delete-PositionIterator + PositionIterator-skip-to + PositionIterator-get-description + PositionIterator-equals + PositionIterator-get-termpos + PositionIterator-next + new-PostingIterator + delete-PostingIterator + PostingIterator-get-wdf + PostingIterator-get-doclength + PostingIterator-get-unique-terms + PostingIterator-positionlist-begin + PostingIterator-positionlist-end + PostingIterator-skip-to + PostingIterator-get-description + PostingIterator-equals + PostingIterator-get-docid + PostingIterator-next + new-TermIterator + delete-TermIterator + TermIterator-get-wdf + TermIterator-get-termfreq + TermIterator-positionlist-count + TermIterator-positionlist-begin + TermIterator-positionlist-end + TermIterator-skip-to + TermIterator-get-description + TermIterator-equals + TermIterator-get-term + TermIterator-next + new-ValueIterator + delete-ValueIterator + ValueIterator-get-docid + ValueIterator-get-valueno + ValueIterator-skip-to + ValueIterator-check + ValueIterator-get-description + ValueIterator-equals + ValueIterator-get-value + ValueIterator-next + new-Document + delete-Document + Document-get-value + Document-add-value + Document-remove-value + Document-clear-values + Document-get-data + Document-set-data + Document-add-posting + Document-add-posting + Document-add-term + Document-add-term + Document-add-boolean-term + Document-remove-posting + Document-remove-posting + Document-remove-postings + Document-remove-postings + Document-remove-term + Document-clear-terms + Document-termlist-count + Document-termlist-begin + Document-termlist-end + Document-values-count + Document-values-begin + Document-values-end + Document-get-docid + Document-serialise + Document-unserialise + Document-get-description + new-Registry + delete-Registry + Registry-register-weighting-scheme + Registry-get-weighting-scheme + Registry-register-posting-source + Registry-get-posting-source + Registry-register-match-spy + Registry-get-match-spy + Registry-register-lat-long-metric + Registry-get-lat-long-metric + Query-MatchNothing + Query-MatchAll + Query-OP-AND + Query-OP-OR + Query-OP-AND-NOT + Query-OP-XOR + Query-OP-AND-MAYBE + Query-OP-FILTER + Query-OP-NEAR + Query-OP-PHRASE + Query-OP-VALUE-RANGE + Query-OP-SCALE-WEIGHT + Query-OP-ELITE-SET + Query-OP-VALUE-GE + Query-OP-VALUE-LE + Query-OP-SYNONYM + Query-OP-MAX + Query-OP-WILDCARD + Query-OP-INVALID + Query-WILDCARD-LIMIT-ERROR + Query-WILDCARD-LIMIT-FIRST + Query-WILDCARD-LIMIT-MOST-FREQUENT + new-Query + delete-Query + new-Query + new-Query + new-Query + new-Query + new-Query + new-Query + new-Query + new-Query + new-Query + new-Query + new-Query + new-Query + new-Query + new-Query + Query-get-terms-begin + Query-get-terms-end + Query-get-unique-terms-begin + Query-get-unique-terms-end + Query-get-length + Query-empty + Query-serialise + Query-unserialise + Query-unserialise + Query-get-type + Query-get-num-subqueries + Query-get-subquery + Query-get-description + new-Query + new-Stem + new-Stem + new-Stem + delete-Stem + Stem-apply + Stem-is-none + Stem-get-description + Stem-get-available-languages + new-TermGenerator + delete-TermGenerator + TermGenerator-set-stemmer + TermGenerator-set-stopper + TermGenerator-set-stopper + TermGenerator-set-document + TermGenerator-get-document + TermGenerator-set-database + TermGenerator-FLAG-SPELLING + TermGenerator-FLAG-CJK-NGRAM + TermGenerator-STEM-NONE + TermGenerator-STEM-SOME + TermGenerator-STEM-ALL + TermGenerator-STEM-ALL-Z + TermGenerator-STEM-SOME-FULL-POS + TermGenerator-STOP-NONE + TermGenerator-STOP-ALL + TermGenerator-STOP-STEMMED + TermGenerator-set-flags + TermGenerator-set-flags + TermGenerator-set-stemming-strategy + TermGenerator-set-stopper-strategy + TermGenerator-set-max-word-length + TermGenerator-index-text + TermGenerator-index-text + TermGenerator-index-text + TermGenerator-index-text-without-positions + TermGenerator-index-text-without-positions + TermGenerator-index-text-without-positions + TermGenerator-increase-termpos + TermGenerator-increase-termpos + TermGenerator-get-termpos + TermGenerator-set-termpos + TermGenerator-get-description + new-MSet + delete-MSet + MSet-convert-to-percent + MSet-convert-to-percent + MSet-get-termfreq + MSet-get-termweight + MSet-get-firstitem + MSet-get-matches-lower-bound + MSet-get-matches-estimated + MSet-get-matches-upper-bound + MSet-get-uncollapsed-matches-lower-bound + MSet-get-uncollapsed-matches-estimated + MSet-get-uncollapsed-matches-upper-bound + MSet-get-max-attained + MSet-get-max-possible + MSet-SNIPPET-BACKGROUND-MODEL + MSet-SNIPPET-EXHAUSTIVE + MSet-SNIPPET-EMPTY-WITHOUT-MATCH + MSet-SNIPPET-CJK-NGRAM + MSet-snippet + MSet-snippet + MSet-snippet + MSet-snippet + MSet-snippet + MSet-snippet + MSet-snippet + MSet-fetch + MSet-fetch + MSet-fetch + MSet-size + MSet-empty + MSet-begin + MSet-end + MSet-back + MSet-get-description + MSet-get-docid + MSet-get-document + MSet-get-hit + MSet-get-document-percentage + MSetIterator-mset-set + MSetIterator-mset-get + MSetIterator-off-from-end-set + MSetIterator-off-from-end-get + new-MSetIterator + MSetIterator-get-rank + MSetIterator-get-document + MSetIterator-get-weight + MSetIterator-get-collapse-key + MSetIterator-get-collapse-count + MSetIterator-get-sort-key + MSetIterator-get-percent + MSetIterator-get-description + MSetIterator-equals + MSetIterator-get-docid + MSetIterator-next + MSetIterator-prev + delete-MSetIterator + new-ESet + delete-ESet + ESet-size + ESet-empty + ESet-get-ebound + ESet-begin + ESet-end + ESet-back + ESet-get-description + ESetIterator-eset-set + ESetIterator-eset-get + ESetIterator-off-from-end-set + ESetIterator-off-from-end-get + new-ESetIterator + ESetIterator-get-weight + ESetIterator-get-description + ESetIterator-equals + ESetIterator-get-term + ESetIterator-next + ESetIterator-prev + delete-ESetIterator + new-RSet + delete-RSet + RSet-size + RSet-empty + RSet-add-document + RSet-add-document + RSet-remove-document + RSet-remove-document + RSet-contains + RSet-contains + RSet-get-description + MatchDecider-apply + delete-MatchDecider + new-Enquire + delete-Enquire + Enquire-set-query + Enquire-set-query + Enquire-get-query + Enquire-add-matchspy + Enquire-clear-matchspies + Enquire-set-weighting-scheme + Enquire-set-expansion-scheme + Enquire-set-expansion-scheme + Enquire-set-collapse-key + Enquire-set-collapse-key + Enquire-ASCENDING + Enquire-DESCENDING + Enquire-DONT-CARE + Enquire-set-docid-order + Enquire-set-cutoff + Enquire-set-cutoff + Enquire-set-sort-by-relevance + Enquire-set-sort-by-value + Enquire-set-sort-by-key + Enquire-set-sort-by-value-then-relevance + Enquire-set-sort-by-key-then-relevance + Enquire-set-sort-by-relevance-then-value + Enquire-set-sort-by-relevance-then-key + Enquire-set-time-limit + Enquire-get-mset + Enquire-get-mset + Enquire-get-mset + Enquire-get-mset + Enquire-get-mset + Enquire-get-mset + Enquire-INCLUDE-QUERY-TERMS + Enquire-USE-EXACT-TERMFREQ + Enquire-get-eset + Enquire-get-eset + Enquire-get-eset + Enquire-get-eset + Enquire-get-eset + Enquire-get-eset + Enquire-get-eset + Enquire-get-eset + Enquire-get-matching-terms-begin + Enquire-get-matching-terms-end + Enquire-get-matching-terms-begin + Enquire-get-matching-terms-end + Enquire-get-description + ExpandDecider-apply + delete-ExpandDecider + ExpandDecider-release + new-ExpandDeciderAnd + ExpandDeciderAnd-apply + delete-ExpandDeciderAnd + new-ExpandDeciderFilterPrefix + ExpandDeciderFilterPrefix-apply + delete-ExpandDeciderFilterPrefix + KeyMaker-apply + delete-KeyMaker + KeyMaker-release + new-MultiValueKeyMaker + MultiValueKeyMaker-apply + MultiValueKeyMaker-add-value + MultiValueKeyMaker-add-value + MultiValueKeyMaker-add-value + delete-MultiValueKeyMaker + RP-SUFFIX + RP-REPEATED + RP-DATE-PREFER-MDY + Stopper-apply + delete-Stopper + Stopper-get-description + Stopper-release + new-SimpleStopper + SimpleStopper-add + SimpleStopper-apply + SimpleStopper-get-description + new-SimpleStopper + delete-SimpleStopper + new-RangeProcessor + new-RangeProcessor + new-RangeProcessor + new-RangeProcessor + delete-RangeProcessor + RangeProcessor-check-range + RangeProcessor-apply + RangeProcessor-release + new-DateRangeProcessor + new-DateRangeProcessor + new-DateRangeProcessor + new-DateRangeProcessor + new-DateRangeProcessor + new-DateRangeProcessor + DateRangeProcessor-apply + delete-DateRangeProcessor + new-NumberRangeProcessor + new-NumberRangeProcessor + new-NumberRangeProcessor + NumberRangeProcessor-apply + delete-NumberRangeProcessor + delete-ValueRangeProcessor + ValueRangeProcessor-apply + ValueRangeProcessor-release + new-StringValueRangeProcessor + new-StringValueRangeProcessor + new-StringValueRangeProcessor + StringValueRangeProcessor-apply + delete-StringValueRangeProcessor + new-DateValueRangeProcessor + new-DateValueRangeProcessor + new-DateValueRangeProcessor + new-DateValueRangeProcessor + new-DateValueRangeProcessor + new-DateValueRangeProcessor + new-DateValueRangeProcessor + DateValueRangeProcessor-apply + delete-DateValueRangeProcessor + new-NumberValueRangeProcessor + new-NumberValueRangeProcessor + new-NumberValueRangeProcessor + NumberValueRangeProcessor-apply + delete-NumberValueRangeProcessor + delete-FieldProcessor + FieldProcessor-apply + FieldProcessor-release + QueryParser-FLAG-BOOLEAN + QueryParser-FLAG-PHRASE + QueryParser-FLAG-LOVEHATE + QueryParser-FLAG-BOOLEAN-ANY-CASE + QueryParser-FLAG-WILDCARD + QueryParser-FLAG-PURE-NOT + QueryParser-FLAG-PARTIAL + QueryParser-FLAG-SPELLING-CORRECTION + QueryParser-FLAG-SYNONYM + QueryParser-FLAG-AUTO-SYNONYMS + QueryParser-FLAG-AUTO-MULTIWORD-SYNONYMS + QueryParser-FLAG-CJK-NGRAM + QueryParser-FLAG-DEFAULT + QueryParser-STEM-NONE + QueryParser-STEM-SOME + QueryParser-STEM-ALL + QueryParser-STEM-ALL-Z + QueryParser-STEM-SOME-FULL-POS + new-QueryParser + delete-QueryParser + QueryParser-set-stemmer + QueryParser-set-stemming-strategy + QueryParser-set-stopper + QueryParser-set-stopper + QueryParser-set-default-op + QueryParser-get-default-op + QueryParser-set-database + QueryParser-set-max-expansion + QueryParser-set-max-expansion + QueryParser-set-max-expansion + QueryParser-set-max-wildcard-expansion + QueryParser-parse-query + QueryParser-parse-query + QueryParser-parse-query + QueryParser-add-prefix + QueryParser-add-prefix + QueryParser-add-boolean-prefix + QueryParser-add-boolean-prefix + QueryParser-add-boolean-prefix + QueryParser-add-boolean-prefix + QueryParser-add-boolean-prefix + QueryParser-add-boolean-prefix + QueryParser-stoplist-begin + QueryParser-stoplist-end + QueryParser-unstem-begin + QueryParser-unstem-end + QueryParser-add-rangeprocessor + QueryParser-add-rangeprocessor + QueryParser-add-valuerangeprocessor + QueryParser-get-corrected-query-string + QueryParser-get-description + sortable-serialise + sortable-unserialise + new-ValueSetMatchDecider + ValueSetMatchDecider-add-value + ValueSetMatchDecider-remove-value + ValueSetMatchDecider-apply + delete-ValueSetMatchDecider + Weight-TWO-STAGE-SMOOTHING + Weight-DIRICHLET-SMOOTHING + Weight-ABSOLUTE-DISCOUNT-SMOOTHING + Weight-JELINEK-MERCER-SMOOTHING + Weight-DIRICHLET-PLUS-SMOOTHING + delete-Weight + Weight-name + Weight-get-sumpart + Weight-get-maxpart + Weight-get-sumextra + Weight-get-maxextra + new-BoolWeight + BoolWeight-name + BoolWeight-get-sumpart + BoolWeight-get-maxpart + BoolWeight-get-sumextra + BoolWeight-get-maxextra + delete-BoolWeight + new-TfIdfWeight + new-TfIdfWeight + TfIdfWeight-name + TfIdfWeight-get-sumpart + TfIdfWeight-get-maxpart + TfIdfWeight-get-sumextra + TfIdfWeight-get-maxextra + delete-TfIdfWeight + new-BM25Weight + new-BM25Weight + BM25Weight-name + BM25Weight-get-sumpart + BM25Weight-get-maxpart + BM25Weight-get-sumextra + BM25Weight-get-maxextra + delete-BM25Weight + new-BM25PlusWeight + new-BM25PlusWeight + BM25PlusWeight-name + BM25PlusWeight-get-sumpart + BM25PlusWeight-get-maxpart + BM25PlusWeight-get-sumextra + BM25PlusWeight-get-maxextra + delete-BM25PlusWeight + new-TradWeight + new-TradWeight + TradWeight-name + TradWeight-get-sumpart + TradWeight-get-maxpart + TradWeight-get-sumextra + TradWeight-get-maxextra + delete-TradWeight + new-InL2Weight + new-InL2Weight + InL2Weight-name + InL2Weight-get-sumpart + InL2Weight-get-maxpart + InL2Weight-get-sumextra + InL2Weight-get-maxextra + delete-InL2Weight + new-IfB2Weight + new-IfB2Weight + IfB2Weight-name + IfB2Weight-get-sumpart + IfB2Weight-get-maxpart + IfB2Weight-get-sumextra + IfB2Weight-get-maxextra + delete-IfB2Weight + new-IneB2Weight + new-IneB2Weight + IneB2Weight-name + IneB2Weight-get-sumpart + IneB2Weight-get-maxpart + IneB2Weight-get-sumextra + IneB2Weight-get-maxextra + delete-IneB2Weight + new-BB2Weight + new-BB2Weight + BB2Weight-name + BB2Weight-get-sumpart + BB2Weight-get-maxpart + BB2Weight-get-sumextra + BB2Weight-get-maxextra + delete-BB2Weight + new-DLHWeight + DLHWeight-name + DLHWeight-get-sumpart + DLHWeight-get-maxpart + DLHWeight-get-sumextra + DLHWeight-get-maxextra + delete-DLHWeight + new-PL2Weight + new-PL2Weight + PL2Weight-name + PL2Weight-get-sumpart + PL2Weight-get-maxpart + PL2Weight-get-sumextra + PL2Weight-get-maxextra + delete-PL2Weight + new-PL2PlusWeight + new-PL2PlusWeight + PL2PlusWeight-name + PL2PlusWeight-get-sumpart + PL2PlusWeight-get-maxpart + PL2PlusWeight-get-sumextra + PL2PlusWeight-get-maxextra + delete-PL2PlusWeight + new-DPHWeight + DPHWeight-name + DPHWeight-get-sumpart + DPHWeight-get-maxpart + DPHWeight-get-sumextra + DPHWeight-get-maxextra + delete-DPHWeight + new-LMWeight + new-LMWeight + new-LMWeight + new-LMWeight + new-LMWeight + LMWeight-name + LMWeight-get-sumpart + LMWeight-get-maxpart + LMWeight-get-sumextra + LMWeight-get-maxextra + delete-LMWeight + CoordWeight-init + new-CoordWeight + CoordWeight-name + CoordWeight-get-sumpart + CoordWeight-get-maxpart + CoordWeight-get-sumextra + CoordWeight-get-maxextra + delete-CoordWeight + Compactor-STANDARD + Compactor-FULL + Compactor-FULLER + new-Compactor + delete-Compactor + Compactor-set-block-size + Compactor-set-renumber + Compactor-set-multipass + Compactor-set-compaction-level + Compactor-set-destdir + Compactor-add-source + Compactor-compact + Compactor-set-status + Compactor-resolve-duplicate-metadata + delete-PostingSource + PostingSource-get-termfreq-min + PostingSource-get-termfreq-est + PostingSource-get-termfreq-max + PostingSource-set-maxweight + PostingSource-get-maxweight + PostingSource-get-weight + PostingSource-get-docid + PostingSource-next + PostingSource-skip-to + PostingSource-check + PostingSource-at-end + PostingSource-name + PostingSource-init + PostingSource-get-description + PostingSource-release + new-ValuePostingSource + ValuePostingSource-get-termfreq-min + ValuePostingSource-get-termfreq-est + ValuePostingSource-get-termfreq-max + ValuePostingSource-next + ValuePostingSource-skip-to + ValuePostingSource-check + ValuePostingSource-at-end + ValuePostingSource-get-docid + ValuePostingSource-init + ValuePostingSource-get-database + ValuePostingSource-get-slot + ValuePostingSource-get-value + ValuePostingSource-done + ValuePostingSource-get-started + ValuePostingSource-set-termfreq-min + ValuePostingSource-set-termfreq-est + ValuePostingSource-set-termfreq-max + delete-ValuePostingSource + new-ValueWeightPostingSource + ValueWeightPostingSource-get-weight + ValueWeightPostingSource-name + ValueWeightPostingSource-init + ValueWeightPostingSource-get-description + delete-ValueWeightPostingSource + new-DecreasingValueWeightPostingSource + new-DecreasingValueWeightPostingSource + new-DecreasingValueWeightPostingSource + DecreasingValueWeightPostingSource-get-weight + DecreasingValueWeightPostingSource-name + DecreasingValueWeightPostingSource-init + DecreasingValueWeightPostingSource-next + DecreasingValueWeightPostingSource-skip-to + DecreasingValueWeightPostingSource-check + DecreasingValueWeightPostingSource-get-description + delete-DecreasingValueWeightPostingSource + new-ValueMapPostingSource + ValueMapPostingSource-add-mapping + ValueMapPostingSource-clear-mappings + ValueMapPostingSource-set-default-weight + ValueMapPostingSource-get-weight + ValueMapPostingSource-name + ValueMapPostingSource-init + ValueMapPostingSource-get-description + delete-ValueMapPostingSource + new-FixedWeightPostingSource + FixedWeightPostingSource-get-termfreq-min + FixedWeightPostingSource-get-termfreq-est + FixedWeightPostingSource-get-termfreq-max + FixedWeightPostingSource-get-weight + FixedWeightPostingSource-next + FixedWeightPostingSource-skip-to + FixedWeightPostingSource-check + FixedWeightPostingSource-at-end + FixedWeightPostingSource-get-docid + FixedWeightPostingSource-name + FixedWeightPostingSource-init + FixedWeightPostingSource-get-description + delete-FixedWeightPostingSource + delete-MatchSpy + MatchSpy-apply + MatchSpy-name + MatchSpy-merge-results + MatchSpy-get-description + MatchSpy-release + new-ValueCountMatchSpy + new-ValueCountMatchSpy + ValueCountMatchSpy-get-total + ValueCountMatchSpy-values-begin + ValueCountMatchSpy-values-end + ValueCountMatchSpy-top-values-begin + ValueCountMatchSpy-top-values-end + ValueCountMatchSpy-apply + ValueCountMatchSpy-name + ValueCountMatchSpy-merge-results + ValueCountMatchSpy-get-description + delete-ValueCountMatchSpy + miles-to-metres + metres-to-miles + LatLongCoord-latitude-set + LatLongCoord-latitude-get + LatLongCoord-longitude-set + LatLongCoord-longitude-get + new-LatLongCoord + new-LatLongCoord + LatLongCoord-unserialise + LatLongCoord-serialise + LatLongCoord-get-description + delete-LatLongCoord + new-LatLongCoordsIterator + LatLongCoordsIterator-equals + LatLongCoordsIterator-get-coord + LatLongCoordsIterator-next + delete-LatLongCoordsIterator + LatLongCoords-begin + LatLongCoords-end + LatLongCoords-size + LatLongCoords-empty + LatLongCoords-append + new-LatLongCoords + new-LatLongCoords + LatLongCoords-unserialise + LatLongCoords-serialise + LatLongCoords-get-description + delete-LatLongCoords + delete-LatLongMetric + LatLongMetric-pointwise-distance + LatLongMetric-apply + LatLongMetric-apply + LatLongMetric-apply + LatLongMetric-name + new-GreatCircleMetric + new-GreatCircleMetric + GreatCircleMetric-pointwise-distance + GreatCircleMetric-name + delete-GreatCircleMetric + new-LatLongDistancePostingSource + new-LatLongDistancePostingSource + new-LatLongDistancePostingSource + new-LatLongDistancePostingSource + new-LatLongDistancePostingSource + new-LatLongDistancePostingSource + new-LatLongDistancePostingSource + new-LatLongDistancePostingSource + delete-LatLongDistancePostingSource + LatLongDistancePostingSource-next + LatLongDistancePostingSource-skip-to + LatLongDistancePostingSource-check + LatLongDistancePostingSource-get-weight + LatLongDistancePostingSource-name + LatLongDistancePostingSource-init + LatLongDistancePostingSource-get-description + new-LatLongDistanceKeyMaker + new-LatLongDistanceKeyMaker + new-LatLongDistanceKeyMaker + new-LatLongDistanceKeyMaker + new-LatLongDistanceKeyMaker + new-LatLongDistanceKeyMaker + delete-LatLongDistanceKeyMaker + LatLongDistanceKeyMaker-apply + Database-add-database + Database-size + new-Database + new-Database + new-Database + new-Database + new-Database + delete-Database + Database-reopen + Database-close + Database-get-description + Database-postlist-begin + Database-postlist-end + Database-termlist-begin + Database-termlist-end + Database-has-positions + Database-positionlist-begin + Database-positionlist-end + Database-allterms-begin + Database-allterms-begin + Database-allterms-end + Database-allterms-end + Database-get-doccount + Database-get-lastdocid + Database-get-avlength + Database-get-total-length + Database-get-termfreq + Database-term-exists + Database-get-collection-freq + Database-get-value-freq + Database-get-value-lower-bound + Database-get-value-upper-bound + Database-get-doclength-lower-bound + Database-get-doclength-upper-bound + Database-get-wdf-upper-bound + Database-valuestream-begin + Database-valuestream-end + Database-get-doclength + Database-get-unique-terms + Database-keep-alive + Database-get-document + Database-get-document + Database-get-spelling-suggestion + Database-get-spelling-suggestion + Database-spellings-begin + Database-spellings-end + Database-synonyms-begin + Database-synonyms-end + Database-synonym-keys-begin + Database-synonym-keys-begin + Database-synonym-keys-end + Database-synonym-keys-end + Database-get-metadata + Database-metadata-keys-begin + Database-metadata-keys-begin + Database-metadata-keys-end + Database-metadata-keys-end + Database-get-uuid + Database-locked + Database-get-revision + Database-check + Database-check + Database-check + Database-check + Database-compact + Database-compact + Database-compact + Database-compact + Database-compact + Database-compact + Database-compact + Database-compact + delete-WritableDatabase + new-WritableDatabase + new-WritableDatabase + new-WritableDatabase + new-WritableDatabase + WritableDatabase-commit + WritableDatabase-flush + WritableDatabase-begin-transaction + WritableDatabase-begin-transaction + WritableDatabase-commit-transaction + WritableDatabase-cancel-transaction + WritableDatabase-add-document + WritableDatabase-delete-document + WritableDatabase-delete-document + WritableDatabase-replace-document + WritableDatabase-replace-document + WritableDatabase-add-spelling + WritableDatabase-add-spelling + WritableDatabase-remove-spelling + WritableDatabase-remove-spelling + WritableDatabase-add-synonym + WritableDatabase-remove-synonym + WritableDatabase-clear-synonyms + WritableDatabase-set-metadata + WritableDatabase-get-description + open-stub + open-stub + inmemory-open + chert-open + chert-open + chert-open + remote-open + remote-open + remote-open + remote-open-writable + remote-open-writable + remote-open-writable + remote-open-writable + remote-open + remote-open + remote-open-writable + remote-open-writable + remote-open-writable) diff --git a/xapian/xapian.scm b/xapian/xapian.scm new file mode 100644 index 0000000..8801838 --- /dev/null +++ b/xapian/xapian.scm @@ -0,0 +1,124 @@ +;;; guile-xapian --- Guile bindings for Xapian +;;; Copyright © 2020 Arun Isaac +;;; +;;; This file is part of guile-xapian. +;;; +;;; guile-xapian is free software: you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation, either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; guile-xapian is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with guile-xapian. If not, see +;;; . + +(define-module (xapian xapian) + #:use-module (ice-9 match) + #:use-module (srfi srfi-26) + #:use-module (xapian wrap) + #:export (xapian-open + xapian-close + call-with-database + xapian-open-writable + xapian-close-writable + call-with-writable-database + add-document! + replace-document! + make-document + document-data + make-stem + make-term-generator + index-text! + increase-termpos! + parse-query + enquire + enquire-mset + mset-item-docid + mset-item-document + mset-item-rank + mset-item-weight + mset-fold)) + +(define xapian-open new-Database) +(define xapian-close delete-Database) + +(define (call-with-database dbpath proc) + (let ((db (xapian-open dbpath))) + (dynamic-wind noop (cut proc db) (cut xapian-close db)))) + +(define xapian-open-writable new-WritableDatabase) +(define xapian-close-writable delete-WritableDatabase) + +(define (call-with-writable-database dbpath proc) + (let ((db (xapian-open-writable dbpath))) + (dynamic-wind noop (cut proc db) (cut xapian-close-writable db)))) + +(define add-document! WritableDatabase-add-document) +(define replace-document! WritableDatabase-replace-document) + +(define* (make-document #:key data (terms '())) + (let ((doc (new-Document))) + (when data + (Document-set-data doc data)) + (for-each (match-lambda + ((term . wdf-increment) + (Document-add-term doc term wdf-increment))) + terms) + doc)) + +(define document-data Document-get-data) + +(define make-stem new-Stem) + +(define* (make-term-generator #:key stem document) + (let ((term-generator (new-TermGenerator))) + (TermGenerator-set-stemmer term-generator stem) + (TermGenerator-set-document term-generator document) + term-generator)) + +(define* (index-text! term-generator text #:key (wdf-increment 1) prefix) + (apply TermGenerator-index-text term-generator text wdf-increment + (if prefix (list prefix) '()))) + +(define increase-termpos! TermGenerator-increase-termpos) + +(define* (parse-query querystring #:key stemmer stemming-strategy (prefixes '())) + (let ((queryparser (new-QueryParser))) + (QueryParser-set-stemmer queryparser stemmer) + (when stemming-strategy + (QueryParser-set-stemming-strategy queryparser stemming-strategy)) + (for-each (match-lambda + ((field . prefix) + (QueryParser-add-prefix queryparser field prefix))) + prefixes) + (let ((query (QueryParser-parse-query queryparser querystring))) + (delete-QueryParser queryparser) + query))) + +(define* (enquire db query #:key weighting-scheme) + (let ((enquire (new-Enquire db))) + (Enquire-set-query enquire query) + (when weighting-scheme + (Enquire-set-weighting-scheme enquire weighting-scheme)) + enquire)) + +(define enquire-mset Enquire-get-mset) + +(define mset-item-docid MSetIterator-get-docid) +(define mset-item-document MSetIterator-get-document) +(define mset-item-rank MSetIterator-get-rank) +(define mset-item-weight MSetIterator-get-weight) + +(define (mset-fold proc init mset) + (let loop ((head (MSet-begin mset)) + (result init)) + (cond + ((MSetIterator-equals head (MSet-end mset)) result) + (else (let ((result (proc head result))) + (MSetIterator-next head) + (loop head result)))))) -- cgit v1.2.3