mhs-xapian 1.0.18a
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/AUTHORS +1 -0
- data/COPYING +340 -0
- data/ChangeLog +5876 -0
- data/HACKING +101 -0
- data/INSTALL +293 -0
- data/Makefile +722 -0
- data/Makefile.am +26 -0
- data/Makefile.in +722 -0
- data/NEWS +2110 -0
- data/README +59 -0
- data/Rakefile +51 -0
- data/TODO +47 -0
- data/aclocal.m4 +7675 -0
- data/config.guess +1501 -0
- data/config.h +56 -0
- data/config.h.in +55 -0
- data/config.status +1298 -0
- data/config.sub +1705 -0
- data/configure +18536 -0
- data/configure.ac +944 -0
- data/csharp/.deps/xapian_wrap.Plo +1 -0
- data/csharp/AssemblyInfo.cs +40 -0
- data/csharp/AssemblyInfo.cs.in +40 -0
- data/csharp/Auto.cs +46 -0
- data/csharp/BM25Weight.cs +107 -0
- data/csharp/BoolWeight.cs +103 -0
- data/csharp/Database.cs +275 -0
- data/csharp/DateValueRangeProcessor.cs +61 -0
- data/csharp/Document.cs +177 -0
- data/csharp/ESet.cs +94 -0
- data/csharp/ESetIterator.cs +117 -0
- data/csharp/Enquire.cs +274 -0
- data/csharp/ExpandDecider.cs +76 -0
- data/csharp/Flint.cs +58 -0
- data/csharp/InMemory.cs +46 -0
- data/csharp/MSet.cs +193 -0
- data/csharp/MSetIterator.cs +141 -0
- data/csharp/Makefile +868 -0
- data/csharp/Makefile.am +106 -0
- data/csharp/Makefile.in +868 -0
- data/csharp/MatchDecider.cs +76 -0
- data/csharp/MultiValueSorter.cs +63 -0
- data/csharp/NumberValueRangeProcessor.cs +61 -0
- data/csharp/PositionIterator.cs +101 -0
- data/csharp/PostingIterator.cs +125 -0
- data/csharp/Quartz.cs +58 -0
- data/csharp/Query.cs +150 -0
- data/csharp/QueryParser.cs +174 -0
- data/csharp/RSet.cs +102 -0
- data/csharp/Remote.cs +100 -0
- data/csharp/SWIGTYPE_p_std__string.cs +30 -0
- data/csharp/SWIGTYPE_p_std__vectorTXapian__Query_t.cs +30 -0
- data/csharp/SWIGTYPE_p_std__vectorTstd__string_t.cs +30 -0
- data/csharp/SimpleStopper.cs +64 -0
- data/csharp/SmokeTest.cs +178 -0
- data/csharp/Sorter.cs +76 -0
- data/csharp/Stem.cs +66 -0
- data/csharp/Stopper.cs +91 -0
- data/csharp/StringValueRangeProcessor.cs +53 -0
- data/csharp/TermGenerator.cs +152 -0
- data/csharp/TermIterator.cs +125 -0
- data/csharp/TradWeight.cs +107 -0
- data/csharp/ValueIterator.cs +102 -0
- data/csharp/ValueRangeProcessor.cs +76 -0
- data/csharp/Version.cs +60 -0
- data/csharp/Weight.cs +93 -0
- data/csharp/WritableDatabase.cs +153 -0
- data/csharp/Xapian.cs +65 -0
- data/csharp/XapianPINVOKE.cs +1527 -0
- data/csharp/docs/Makefile +450 -0
- data/csharp/docs/Makefile.am +16 -0
- data/csharp/docs/Makefile.in +450 -0
- data/csharp/docs/examples/SimpleExpand.cs +109 -0
- data/csharp/docs/examples/SimpleIndex.cs +71 -0
- data/csharp/docs/examples/SimpleSearch.cs +78 -0
- data/csharp/docs/index.html +211 -0
- data/csharp/util.i +233 -0
- data/csharp/xapian_wrap.cc +10338 -0
- data/csharp/xapian_wrap.h +93 -0
- data/depcomp +632 -0
- data/extconf.rb +20 -0
- data/generic/except.i +80 -0
- data/generic/generic.mk +48 -0
- data/install-sh +520 -0
- data/java-swig/.deps/xapian_wrap.Plo +1 -0
- data/java-swig/Auto.java +35 -0
- data/java-swig/BM25Weight.java +81 -0
- data/java-swig/BoolWeight.java +77 -0
- data/java-swig/Database.java +195 -0
- data/java-swig/DateValueRangeProcessor.java +51 -0
- data/java-swig/Document.java +135 -0
- data/java-swig/ESet.java +71 -0
- data/java-swig/ESetIterator.java +71 -0
- data/java-swig/Enquire.java +246 -0
- data/java-swig/ExpandDecider.java +59 -0
- data/java-swig/Flint.java +43 -0
- data/java-swig/InMemory.java +35 -0
- data/java-swig/MSet.java +143 -0
- data/java-swig/MSetIterator.java +87 -0
- data/java-swig/Makefile +781 -0
- data/java-swig/Makefile.am +132 -0
- data/java-swig/Makefile.in +781 -0
- data/java-swig/MatchDecider.java +59 -0
- data/java-swig/MultiValueSorter.java +51 -0
- data/java-swig/NumberValueRangeProcessor.java +51 -0
- data/java-swig/PositionIterator.java +63 -0
- data/java-swig/PostingIterator.java +83 -0
- data/java-swig/Quartz.java +43 -0
- data/java-swig/Query.java +189 -0
- data/java-swig/QueryParser.java +214 -0
- data/java-swig/RSet.java +79 -0
- data/java-swig/Remote.java +71 -0
- data/java-swig/SWIGTYPE_p_std__string.java +25 -0
- data/java-swig/SimpleStopper.java +51 -0
- data/java-swig/SmokeTest.java +161 -0
- data/java-swig/Sorter.java +59 -0
- data/java-swig/Stem.java +51 -0
- data/java-swig/Stopper.java +63 -0
- data/java-swig/StringValueRangeProcessor.java +43 -0
- data/java-swig/TermGenerator.java +158 -0
- data/java-swig/TermIterator.java +83 -0
- data/java-swig/TradWeight.java +81 -0
- data/java-swig/ValueIterator.java +67 -0
- data/java-swig/ValueRangeProcessor.java +59 -0
- data/java-swig/Version.java +47 -0
- data/java-swig/Weight.java +68 -0
- data/java-swig/WritableDatabase.java +123 -0
- data/java-swig/Xapian.java +39 -0
- data/java-swig/XapianConstants.java +15 -0
- data/java-swig/XapianJNI.java +508 -0
- data/java-swig/run-java-test +6 -0
- data/java-swig/xapian_wrap.cc +12594 -0
- data/java-swig/xapian_wrap.h +91 -0
- data/java/Makefile +660 -0
- data/java/Makefile.am +35 -0
- data/java/Makefile.in +660 -0
- data/java/README +76 -0
- data/java/SmokeTest.java +148 -0
- data/java/native/.deps/Database.Plo +1 -0
- data/java/native/.deps/Document.Plo +1 -0
- data/java/native/.deps/ESet.Plo +1 -0
- data/java/native/.deps/ESetIterator.Plo +1 -0
- data/java/native/.deps/Enquire.Plo +1 -0
- data/java/native/.deps/MSet.Plo +1 -0
- data/java/native/.deps/MSetIterator.Plo +1 -0
- data/java/native/.deps/PositionIterator.Plo +1 -0
- data/java/native/.deps/Query.Plo +1 -0
- data/java/native/.deps/RSet.Plo +1 -0
- data/java/native/.deps/Stem.Plo +1 -0
- data/java/native/.deps/TermIterator.Plo +1 -0
- data/java/native/.deps/WritableDatabase.Plo +1 -0
- data/java/native/.deps/org_xapian_XapianJNI.Plo +1 -0
- data/java/native/.deps/utils.Plo +1 -0
- data/java/native/Database.cc +222 -0
- data/java/native/Document.cc +173 -0
- data/java/native/ESet.cc +79 -0
- data/java/native/ESetIterator.cc +82 -0
- data/java/native/Enquire.cc +271 -0
- data/java/native/MSet.cc +169 -0
- data/java/native/MSetIterator.cc +107 -0
- data/java/native/Makefile +594 -0
- data/java/native/Makefile.am +51 -0
- data/java/native/Makefile.in +594 -0
- data/java/native/PositionIterator.cc +64 -0
- data/java/native/Query.cc +180 -0
- data/java/native/RSet.cc +98 -0
- data/java/native/Stem.cc +75 -0
- data/java/native/TermIterator.cc +107 -0
- data/java/native/WritableDatabase.cc +118 -0
- data/java/native/XapianObjectHolder.h +115 -0
- data/java/native/org_xapian_XapianJNI.cc +78 -0
- data/java/native/org_xapian_XapianJNI.h +1369 -0
- data/java/native/utils.cc +51 -0
- data/java/native/xapian_jni.h +116 -0
- data/java/org/xapian/Database.java +148 -0
- data/java/org/xapian/Document.java +135 -0
- data/java/org/xapian/ESet.java +66 -0
- data/java/org/xapian/ESetIterator.java +97 -0
- data/java/org/xapian/Enquire.java +136 -0
- data/java/org/xapian/ExpandDecider.java +30 -0
- data/java/org/xapian/MSet.java +104 -0
- data/java/org/xapian/MSetIterator.java +132 -0
- data/java/org/xapian/Makefile +580 -0
- data/java/org/xapian/Makefile.am +38 -0
- data/java/org/xapian/Makefile.in +580 -0
- data/java/org/xapian/MatchDecider.java +30 -0
- data/java/org/xapian/PositionIterator.java +89 -0
- data/java/org/xapian/Query.java +190 -0
- data/java/org/xapian/RSet.java +89 -0
- data/java/org/xapian/Stem.java +80 -0
- data/java/org/xapian/TermIterator.java +142 -0
- data/java/org/xapian/WritableDatabase.java +92 -0
- data/java/org/xapian/Xapian.java +114 -0
- data/java/org/xapian/XapianJNI.java +444 -0
- data/java/org/xapian/errors/AssertionError.java +40 -0
- data/java/org/xapian/errors/DatabaseCorruptError.java +40 -0
- data/java/org/xapian/errors/DatabaseError.java +40 -0
- data/java/org/xapian/errors/DatabaseLockError.java +40 -0
- data/java/org/xapian/errors/DatabaseModifiedError.java +40 -0
- data/java/org/xapian/errors/DatabaseOpeningError.java +40 -0
- data/java/org/xapian/errors/DocNotFoundError.java +40 -0
- data/java/org/xapian/errors/FeatureUnavailableError.java +40 -0
- data/java/org/xapian/errors/InternalError.java +40 -0
- data/java/org/xapian/errors/InvalidArgumentError.java +40 -0
- data/java/org/xapian/errors/InvalidOperationError.java +40 -0
- data/java/org/xapian/errors/LogicError.java +40 -0
- data/java/org/xapian/errors/Makefile +416 -0
- data/java/org/xapian/errors/Makefile.am +32 -0
- data/java/org/xapian/errors/Makefile.in +416 -0
- data/java/org/xapian/errors/NetworkError.java +40 -0
- data/java/org/xapian/errors/NetworkTimeoutError.java +40 -0
- data/java/org/xapian/errors/RangeError.java +40 -0
- data/java/org/xapian/errors/RuntimeError.java +40 -0
- data/java/org/xapian/errors/UnimplementedError.java +40 -0
- data/java/org/xapian/errors/XapianError.java +40 -0
- data/java/org/xapian/errors/XapianRuntimeError.java +49 -0
- data/java/org/xapian/examples/Makefile +391 -0
- data/java/org/xapian/examples/Makefile.am +8 -0
- data/java/org/xapian/examples/Makefile.in +391 -0
- data/java/org/xapian/examples/SimpleIndex.java +68 -0
- data/java/org/xapian/examples/SimpleSearch.java +71 -0
- data/java/run-java-test +6 -0
- data/libtool +7618 -0
- data/ltmain.sh +6956 -0
- data/mhs-xapian.gemspec +368 -0
- data/missing +378 -0
- data/php/.deps/xapian_wrap.Plo +1 -0
- data/php/Makefile +871 -0
- data/php/Makefile.am +82 -0
- data/php/Makefile.in +871 -0
- data/php/docs/Makefile +453 -0
- data/php/docs/Makefile.am +19 -0
- data/php/docs/Makefile.in +453 -0
- data/php/docs/examples/simpleexpand.php4 +108 -0
- data/php/docs/examples/simpleexpand.php5 +104 -0
- data/php/docs/examples/simpleindex.php4 +76 -0
- data/php/docs/examples/simpleindex.php5 +73 -0
- data/php/docs/examples/simplesearch.php4 +75 -0
- data/php/docs/examples/simplesearch.php5 +72 -0
- data/php/docs/index.html +313 -0
- data/php/except.i +98 -0
- data/php/php4/php_xapian.h +323 -0
- data/php/php4/xapian.php +32 -0
- data/php/php4/xapian_wrap.cc +27656 -0
- data/php/php5/php_xapian.h +319 -0
- data/php/php5/xapian.php +1566 -0
- data/php/php5/xapian_wrap.cc +24330 -0
- data/php/smoketest.php +246 -0
- data/php/smoketest4.php +84 -0
- data/php/smoketest5.php +79 -0
- data/php/util.i +187 -0
- data/python/.deps/xapian_wrap.Plo +1 -0
- data/python/Makefile +891 -0
- data/python/Makefile.am +105 -0
- data/python/Makefile.in +891 -0
- data/python/doccomments.i +5134 -0
- data/python/docs/Makefile +448 -0
- data/python/docs/Makefile.am +14 -0
- data/python/docs/Makefile.in +448 -0
- data/python/docs/examples/simpleexpand.py +98 -0
- data/python/docs/examples/simpleindex.py +65 -0
- data/python/docs/examples/simplematchdecider.py +78 -0
- data/python/docs/examples/simplesearch.py +65 -0
- data/python/docs/index.html +420 -0
- data/python/except.i +290 -0
- data/python/extra.i +1048 -0
- data/python/extracomments.i +28 -0
- data/python/generate-python-exceptions +189 -0
- data/python/generate-python-exceptions.in +189 -0
- data/python/modern/xapian.py +5662 -0
- data/python/modern/xapian_wrap.cc +35170 -0
- data/python/modern/xapian_wrap.h +244 -0
- data/python/pythontest.py +1110 -0
- data/python/smoketest.py +328 -0
- data/python/testsuite.py +382 -0
- data/python/util.i +517 -0
- data/ruby/.deps/xapian_wrap.Plo +494 -0
- data/ruby/.libs/_xapian.bundle +0 -0
- data/ruby/.libs/_xapian.bundle.dSYM/Contents/Info.plist +25 -0
- data/ruby/.libs/_xapian.bundle.dSYM/Contents/Resources/DWARF/_xapian.bundle +0 -0
- data/ruby/.libs/_xapian.la +35 -0
- data/ruby/.libs/_xapian.lai +35 -0
- data/ruby/Makefile +854 -0
- data/ruby/Makefile.am +62 -0
- data/ruby/Makefile.in +854 -0
- data/ruby/_xapian.la +35 -0
- data/ruby/docs/Makefile +487 -0
- data/ruby/docs/Makefile.am +50 -0
- data/ruby/docs/Makefile.in +487 -0
- data/ruby/docs/examples/simpleexpand.rb +98 -0
- data/ruby/docs/examples/simpleindex.rb +60 -0
- data/ruby/docs/examples/simplematchdecider.rb +74 -0
- data/ruby/docs/examples/simplesearch.rb +63 -0
- data/ruby/docs/index.html +197 -0
- data/ruby/smoketest.rb +211 -0
- data/ruby/util.i +232 -0
- data/ruby/xapian.rb +280 -0
- data/ruby/xapian_wrap.cc +25837 -0
- data/ruby/xapian_wrap.h +65 -0
- data/ruby/xapian_wrap.lo +12 -0
- data/skiptest +2 -0
- data/stamp-h1 +1 -0
- data/tcl8/.deps/xapian_wrap.Plo +1 -0
- data/tcl8/Makefile +835 -0
- data/tcl8/Makefile.am +49 -0
- data/tcl8/Makefile.in +835 -0
- data/tcl8/docs/Makefile +448 -0
- data/tcl8/docs/Makefile.am +14 -0
- data/tcl8/docs/Makefile.in +448 -0
- data/tcl8/docs/examples/simpleexpand.tcl +104 -0
- data/tcl8/docs/examples/simpleindex.tcl +68 -0
- data/tcl8/docs/examples/simplesearch.tcl +66 -0
- data/tcl8/docs/index.html +208 -0
- data/tcl8/except.i +48 -0
- data/tcl8/pkgIndex.tcl +1 -0
- data/tcl8/pkgIndex.tcl.in +1 -0
- data/tcl8/run-tcl-test +15 -0
- data/tcl8/runtest.tcl +29 -0
- data/tcl8/smoketest.tcl +155 -0
- data/tcl8/util.i +76 -0
- data/tcl8/xapian_wrap.cc +20900 -0
- data/xapian-bindings.spec +206 -0
- data/xapian-bindings.spec.in +206 -0
- data/xapian-version.h +1 -0
- data/xapian-version.h.in +1 -0
- data/xapian.i +939 -0
- metadata +395 -0
@@ -0,0 +1,142 @@
|
|
1
|
+
/**
|
2
|
+
Copyright (c) 2003, Technology Concepts & Design, Inc.
|
3
|
+
All rights reserved.
|
4
|
+
|
5
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted
|
6
|
+
provided that the following conditions are met:
|
7
|
+
|
8
|
+
- Redistributions of source code must retain the above copyright notice, this list of conditions
|
9
|
+
and the following disclaimer.
|
10
|
+
|
11
|
+
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
12
|
+
and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
13
|
+
|
14
|
+
- Neither the name of Technology Concepts & Design, Inc. nor the names of its contributors may be used to
|
15
|
+
endorse or promote products derived from this software without specific prior written permission.
|
16
|
+
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
18
|
+
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
19
|
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
20
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
21
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
22
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
23
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
24
|
+
THE POSSIBILITY OF SUCH DAMAGE.
|
25
|
+
**/
|
26
|
+
package org.xapian;
|
27
|
+
|
28
|
+
import org.xapian.errors.InvalidOperationError;
|
29
|
+
import org.xapian.errors.XapianError;
|
30
|
+
import org.xapian.errors.XapianRuntimeError;
|
31
|
+
|
32
|
+
import java.util.Iterator;
|
33
|
+
|
34
|
+
public class TermIterator implements Iterator {
|
35
|
+
|
36
|
+
private class Info {
|
37
|
+
String term;
|
38
|
+
int freq;
|
39
|
+
long wdf;
|
40
|
+
|
41
|
+
void set(String term, int freq, long wdf) {
|
42
|
+
this.term = term;
|
43
|
+
this.freq = freq;
|
44
|
+
this.wdf = wdf;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
long id;
|
49
|
+
private long _end;
|
50
|
+
private final long _dbdocid;
|
51
|
+
private Info _info = new Info();
|
52
|
+
private String _filter = null;
|
53
|
+
private boolean _hasNext = true;
|
54
|
+
|
55
|
+
TermIterator(long id, long end_id) throws XapianError {
|
56
|
+
this(-1, id, end_id);
|
57
|
+
}
|
58
|
+
|
59
|
+
TermIterator(long dbdocid, long id, long end_id) throws XapianError {
|
60
|
+
_dbdocid = dbdocid;
|
61
|
+
this.id = id;
|
62
|
+
_end = end_id;
|
63
|
+
_hasNext = !XapianJNI.termiterator_equals(id, end_id);
|
64
|
+
}
|
65
|
+
|
66
|
+
public void skip_to(String term) throws XapianError {
|
67
|
+
XapianJNI.termiterator_skip_to(id, term);
|
68
|
+
}
|
69
|
+
|
70
|
+
public void setFilter(String filter) throws XapianError {
|
71
|
+
_filter = filter;
|
72
|
+
skip_to(filter);
|
73
|
+
if (XapianJNI.termiterator_equals(id, _end))
|
74
|
+
_hasNext = false;
|
75
|
+
else if (_filter != null && !XapianJNI.termiterator_get_termname(id).startsWith(_filter))
|
76
|
+
_hasNext = false;
|
77
|
+
else
|
78
|
+
_hasNext = true;
|
79
|
+
}
|
80
|
+
|
81
|
+
public boolean hasNext() {
|
82
|
+
return _hasNext;
|
83
|
+
}
|
84
|
+
|
85
|
+
public Object next() {
|
86
|
+
try {
|
87
|
+
String termname = XapianJNI.termiterator_get_termname(id);
|
88
|
+
_info.set(termname,
|
89
|
+
_dbdocid != -1 ? -1 : XapianJNI.termiterator_get_term_freq(id), // can't get term frequency when we have a document id
|
90
|
+
XapianJNI.termiterator_get_wdf(id));
|
91
|
+
|
92
|
+
XapianJNI.termiterator_next(id);
|
93
|
+
if (XapianJNI.termiterator_equals(id, _end))
|
94
|
+
_hasNext = false;
|
95
|
+
else if (_filter != null && !XapianJNI.termiterator_get_termname(id).startsWith(_filter))
|
96
|
+
_hasNext = false;
|
97
|
+
else
|
98
|
+
_hasNext = true;
|
99
|
+
return termname;
|
100
|
+
} catch (XapianError xe) {
|
101
|
+
throw new XapianRuntimeError(xe);
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
public int getTermFrequency() {
|
106
|
+
return _info.freq;
|
107
|
+
}
|
108
|
+
|
109
|
+
public long getWdf() {
|
110
|
+
return _info.wdf;
|
111
|
+
}
|
112
|
+
|
113
|
+
public PositionIterator getPositionListIterator(Database db) throws XapianError {
|
114
|
+
if (_dbdocid == -1)
|
115
|
+
throw new InvalidOperationError("No Document id associated with this TermIterator");
|
116
|
+
|
117
|
+
return db.getPositionIterator(_dbdocid, _info.term);
|
118
|
+
|
119
|
+
// this is what I think should happen, but Xapian throws:
|
120
|
+
// InvalidOperationError: positionlist_begin not supported
|
121
|
+
// return new PositionIterator (XapianJNI.termiterator_positionlist_begin(id), XapianJNI.termiterator_positionlist_end(id));
|
122
|
+
}
|
123
|
+
|
124
|
+
|
125
|
+
public void remove() {
|
126
|
+
throw new UnsupportedOperationException("TermIterator.remove() not supported");
|
127
|
+
}
|
128
|
+
|
129
|
+
protected void finalize() throws Throwable {
|
130
|
+
XapianJNI.termiterator_finalize(id);
|
131
|
+
XapianJNI.termiterator_finalize(_end);
|
132
|
+
super.finalize();
|
133
|
+
}
|
134
|
+
|
135
|
+
public String toString() {
|
136
|
+
try {
|
137
|
+
return XapianJNI.termiterator_get_description(id);
|
138
|
+
} catch (XapianError xe) {
|
139
|
+
throw new XapianRuntimeError(xe);
|
140
|
+
}
|
141
|
+
}
|
142
|
+
}
|
@@ -0,0 +1,92 @@
|
|
1
|
+
/**
|
2
|
+
Copyright (c) 2003, Technology Concepts & Design, Inc.
|
3
|
+
All rights reserved.
|
4
|
+
|
5
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted
|
6
|
+
provided that the following conditions are met:
|
7
|
+
|
8
|
+
- Redistributions of source code must retain the above copyright notice, this list of conditions
|
9
|
+
and the following disclaimer.
|
10
|
+
|
11
|
+
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
12
|
+
and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
13
|
+
|
14
|
+
- Neither the name of Technology Concepts & Design, Inc. nor the names of its contributors may be used to
|
15
|
+
endorse or promote products derived from this software without specific prior written permission.
|
16
|
+
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
18
|
+
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
19
|
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
20
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
21
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
22
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
23
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
24
|
+
THE POSSIBILITY OF SUCH DAMAGE.
|
25
|
+
**/
|
26
|
+
package org.xapian;
|
27
|
+
|
28
|
+
|
29
|
+
import org.xapian.errors.*;
|
30
|
+
|
31
|
+
public class WritableDatabase extends Database {
|
32
|
+
|
33
|
+
protected WritableDatabase(long id) {
|
34
|
+
super(id);
|
35
|
+
}
|
36
|
+
|
37
|
+
public WritableDatabase() throws XapianError {
|
38
|
+
super(XapianJNI.writabledatabase_new());
|
39
|
+
}
|
40
|
+
|
41
|
+
public WritableDatabase(String path, int mode) throws XapianError {
|
42
|
+
super(XapianJNI.writabledatabase_new(path, mode));
|
43
|
+
}
|
44
|
+
|
45
|
+
public void flush() throws XapianError, DatabaseError {
|
46
|
+
XapianJNI.writabledatabase_flush(id);
|
47
|
+
}
|
48
|
+
|
49
|
+
public void beginTransaction() throws XapianError, UnimplementedError, InvalidOperationError {
|
50
|
+
XapianJNI.writabledatabase_begin_transaction(id);
|
51
|
+
}
|
52
|
+
|
53
|
+
public void commitTransaction() throws XapianError, DatabaseError, UnimplementedError, InvalidOperationError {
|
54
|
+
XapianJNI.writabledatabase_commit_transaction(id);
|
55
|
+
}
|
56
|
+
|
57
|
+
public void cancelTransaction() throws XapianError, DatabaseError, UnimplementedError, InvalidOperationError {
|
58
|
+
XapianJNI.writabledatabase_cancel_transaction(id);
|
59
|
+
}
|
60
|
+
|
61
|
+
public long addDocument(Document doc) throws XapianError, DatabaseError {
|
62
|
+
return XapianJNI.writabledatabase_add_document(id, doc.id);
|
63
|
+
}
|
64
|
+
|
65
|
+
public void deleteDocument(long docid) throws XapianError, DatabaseError {
|
66
|
+
XapianJNI.writabledatabase_delete_document(id, docid);
|
67
|
+
}
|
68
|
+
|
69
|
+
public void replaceDocument(long which_docid, Document newdoc) throws XapianError, DatabaseError {
|
70
|
+
XapianJNI.writabledatabase_replace_document(id, which_docid, newdoc.id);
|
71
|
+
}
|
72
|
+
|
73
|
+
public String toString() {
|
74
|
+
try {
|
75
|
+
return XapianJNI.writabledatabase_get_description(id);
|
76
|
+
} catch (XapianError xe) {
|
77
|
+
throw new XapianRuntimeError(xe);
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
/**
|
82
|
+
* explicitly close this WritableDatabase right now
|
83
|
+
*/
|
84
|
+
public void finalize() throws Throwable {
|
85
|
+
if (id > -1) {
|
86
|
+
XapianJNI.writabledatabase_finalize(id);
|
87
|
+
id = -1;
|
88
|
+
}
|
89
|
+
|
90
|
+
super.finalize();
|
91
|
+
}
|
92
|
+
}
|
@@ -0,0 +1,114 @@
|
|
1
|
+
/**
|
2
|
+
Copyright (c) 2003, Technology Concepts & Design, Inc.
|
3
|
+
All rights reserved.
|
4
|
+
|
5
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted
|
6
|
+
provided that the following conditions are met:
|
7
|
+
|
8
|
+
- Redistributions of source code must retain the above copyright notice, this list of conditions
|
9
|
+
and the following disclaimer.
|
10
|
+
|
11
|
+
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
12
|
+
and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
13
|
+
|
14
|
+
- Neither the name of Technology Concepts & Design, Inc. nor the names of its contributors may be used to
|
15
|
+
endorse or promote products derived from this software without specific prior written permission.
|
16
|
+
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
18
|
+
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
19
|
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
20
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
21
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
22
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
23
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
24
|
+
THE POSSIBILITY OF SUCH DAMAGE.
|
25
|
+
**/
|
26
|
+
package org.xapian;
|
27
|
+
|
28
|
+
import org.xapian.errors.XapianError;
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Main Entry point for creating Xapian databases. Provides support for the
|
32
|
+
* built-in Xapian namespaces of <code>Auto</code>, <code>InMemory</code>,
|
33
|
+
* <code>Quartz</code>, and <code>Remote</code>
|
34
|
+
*/
|
35
|
+
public final class Xapian {
|
36
|
+
public static final int DB_CREATE_OR_OPEN = 1;
|
37
|
+
public static final int DB_CREATE = 2;
|
38
|
+
public static final int DB_CREATE_OR_OVERWRITE = 3;
|
39
|
+
public static final int DB_OPEN = 4;
|
40
|
+
|
41
|
+
public static final class Auto {
|
42
|
+
public static Database open(String path) throws XapianError {
|
43
|
+
if (path == null)
|
44
|
+
throw new IllegalArgumentException("path cannot be null");
|
45
|
+
return new Database(XapianJNI.auto_open(path));
|
46
|
+
}
|
47
|
+
|
48
|
+
public static WritableDatabase open(String path, int mode) throws XapianError {
|
49
|
+
if (path == null)
|
50
|
+
throw new IllegalArgumentException("path cannot be null");
|
51
|
+
return new WritableDatabase(XapianJNI.auto_open(path, mode));
|
52
|
+
}
|
53
|
+
|
54
|
+
public static Database open_stub(String path) throws XapianError {
|
55
|
+
if (path == null)
|
56
|
+
throw new IllegalArgumentException("path cannot be null");
|
57
|
+
return new Database(XapianJNI.auto_open_stub(path));
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
public static final class InMemory {
|
62
|
+
public static WritableDatabase open() throws XapianError {
|
63
|
+
return new WritableDatabase(XapianJNI.inmemory_open());
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
public static final class Quartz {
|
68
|
+
public static Database open(String dir) throws XapianError {
|
69
|
+
if (dir == null)
|
70
|
+
throw new IllegalArgumentException("dir cannot be null");
|
71
|
+
return new Database(XapianJNI.quartz_open(dir));
|
72
|
+
}
|
73
|
+
|
74
|
+
public static WritableDatabase open(String dir, int action) throws XapianError {
|
75
|
+
if (dir == null)
|
76
|
+
throw new IllegalArgumentException("dir cannot be null");
|
77
|
+
return new WritableDatabase(XapianJNI.quartz_open(dir, action));
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
public static final class Remote {
|
82
|
+
public static Database open(String program, String args) throws XapianError {
|
83
|
+
if (program == null)
|
84
|
+
throw new IllegalArgumentException("program cannot be null");
|
85
|
+
else if (args == null)
|
86
|
+
throw new IllegalArgumentException("args cannot be null");
|
87
|
+
return new Database(XapianJNI.remote_open(program, args));
|
88
|
+
}
|
89
|
+
|
90
|
+
public static Database open(String program, String args, int timeout) throws XapianError {
|
91
|
+
if (program == null)
|
92
|
+
throw new IllegalArgumentException("program cannot be null");
|
93
|
+
else if (args == null)
|
94
|
+
throw new IllegalArgumentException("args cannot be null");
|
95
|
+
return new Database(XapianJNI.remote_open(program, args, timeout));
|
96
|
+
}
|
97
|
+
|
98
|
+
public static Database open(String host, int port) throws XapianError {
|
99
|
+
if (host == null)
|
100
|
+
throw new IllegalArgumentException("host cannot be null");
|
101
|
+
else if (port < 0)
|
102
|
+
throw new IllegalArgumentException("port cannot be negative");
|
103
|
+
return new Database(XapianJNI.remote_open(host, port));
|
104
|
+
}
|
105
|
+
|
106
|
+
public static Database open(String host, int port, int timeout, int connect_timeout) throws XapianError {
|
107
|
+
if (host == null)
|
108
|
+
throw new IllegalArgumentException("host cannot be null");
|
109
|
+
else if (port < 0)
|
110
|
+
throw new IllegalArgumentException("port cannot be negative");
|
111
|
+
return new Database(XapianJNI.remote_open(host, port, timeout, connect_timeout));
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}
|
@@ -0,0 +1,444 @@
|
|
1
|
+
/**
|
2
|
+
Copyright (c) 2003, Technology Concepts & Design, Inc.
|
3
|
+
Copyright (c) 2006, Olly Betts
|
4
|
+
All rights reserved.
|
5
|
+
|
6
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted
|
7
|
+
provided that the following conditions are met:
|
8
|
+
|
9
|
+
- Redistributions of source code must retain the above copyright notice, this list of conditions
|
10
|
+
and the following disclaimer.
|
11
|
+
|
12
|
+
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
13
|
+
and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
14
|
+
|
15
|
+
- Neither the name of Technology Concepts & Design, Inc. nor the names of its contributors may be used to
|
16
|
+
endorse or promote products derived from this software without specific prior written permission.
|
17
|
+
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
19
|
+
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
20
|
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
21
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
22
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
23
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
24
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
25
|
+
THE POSSIBILITY OF SUCH DAMAGE.
|
26
|
+
**/
|
27
|
+
package org.xapian;
|
28
|
+
|
29
|
+
import org.xapian.errors.*;
|
30
|
+
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Static proxy class that gets us access to Xapian.<p>
|
34
|
+
* <p/>
|
35
|
+
* Although this class is defined as <i>public</i>, it is not
|
36
|
+
* meant to be used outside this package. It is available
|
37
|
+
* for those that desire lower-level access to Xapian without
|
38
|
+
* going through the API classes in this package.
|
39
|
+
*/
|
40
|
+
public class XapianJNI {
|
41
|
+
|
42
|
+
static {
|
43
|
+
// static initialization for loading the native library
|
44
|
+
System.loadLibrary("xapian_jni");
|
45
|
+
}
|
46
|
+
|
47
|
+
|
48
|
+
// functions to support the Xapian::Auto namespace
|
49
|
+
public static final int DB_CREATE_OR_OPEN = 1;
|
50
|
+
public static final int DB_CREATE = 2;
|
51
|
+
public static final int DB_CREATE_OR_OVERWRITE = 3;
|
52
|
+
public static final int DB_OPEN = 4;
|
53
|
+
|
54
|
+
/* Returns id of a Xapian::Database (deprecated) */
|
55
|
+
public static native long auto_open(String path) throws XapianError;
|
56
|
+
|
57
|
+
/* Returns id of a Xapian::WritableDatabase (deprecated) */
|
58
|
+
public static native long auto_open(String path, int mode) throws XapianError;
|
59
|
+
|
60
|
+
/* Returns id of a Xapian::Database */
|
61
|
+
public static native long auto_open_stub(String path) throws XapianError;
|
62
|
+
|
63
|
+
// support for the Xapian::InMemory namespace
|
64
|
+
/* Returns id of a Xapian::WritableDatabase */
|
65
|
+
public static native long inmemory_open() throws XapianError;
|
66
|
+
|
67
|
+
// support for the Xapian::Quartz namespace
|
68
|
+
/* Returns id of a Xapian::Database */
|
69
|
+
public static native long quartz_open(String dir) throws XapianError;
|
70
|
+
|
71
|
+
/* Returns id of a Xapian::WritableDatabase */
|
72
|
+
public static long quartz_open(String dir, int action) throws XapianError {
|
73
|
+
return quartz_open(dir, action, 8192);
|
74
|
+
}
|
75
|
+
|
76
|
+
/* Returns id of a Xapian::WritableDatabase */
|
77
|
+
public static native long quartz_open(String dir, int action, int block_size) throws XapianError;
|
78
|
+
|
79
|
+
// support for the Xapian::Remote namespace
|
80
|
+
/* Returns id of a Xapian::Database */
|
81
|
+
public static long remote_open(String program, String args) throws XapianError {
|
82
|
+
return remote_open(program, args, 10000);
|
83
|
+
}
|
84
|
+
|
85
|
+
/* Returns id of a Xapian::Database */
|
86
|
+
public static native long remote_open(String program, String args, int timeout) throws XapianError;
|
87
|
+
|
88
|
+
/* Returns id of a Xapian::Database */
|
89
|
+
public static long remote_open(String host, int port) throws XapianError {
|
90
|
+
return remote_open(host, port, 10000, 0);
|
91
|
+
}
|
92
|
+
|
93
|
+
public static native long remote_open(String host, int port, int timeout, int connect_timeout) throws XapianError;
|
94
|
+
|
95
|
+
|
96
|
+
// database functions
|
97
|
+
public static native long database_new() throws XapianError;
|
98
|
+
|
99
|
+
public static native long database_new(String path) throws XapianError;
|
100
|
+
|
101
|
+
public static native long database_new(long dbid) throws XapianError;
|
102
|
+
|
103
|
+
public static native void database_add_database(long dbid, long toadd_id) throws XapianError;
|
104
|
+
|
105
|
+
public static native void database_reopen(long dbid) throws XapianError;
|
106
|
+
|
107
|
+
public static native String database_get_description(long dbid) throws XapianError;
|
108
|
+
|
109
|
+
public static native long database_postlist_begin(long dbid, String term) throws XapianError;
|
110
|
+
|
111
|
+
public static native long database_postlist_end(long dbid, String term) throws XapianError;
|
112
|
+
|
113
|
+
public static native long database_termlist_begin(long dbid, long assigned_docid) throws XapianError;
|
114
|
+
|
115
|
+
public static native long database_termlist_end(long dbid, long assigned_docid) throws XapianError;
|
116
|
+
|
117
|
+
public static native long database_positionlist_begin(long dbid, long dbdocid, String term) throws XapianError;
|
118
|
+
|
119
|
+
public static native long database_positionlist_end(long dbid, long dbdocid, String term) throws XapianError;
|
120
|
+
|
121
|
+
public static native long database_allterms_begin(long dbid) throws XapianError;
|
122
|
+
|
123
|
+
public static native long database_allterms_end(long dbid) throws XapianError;
|
124
|
+
|
125
|
+
public static native int database_get_doccount(long dbid) throws XapianError;
|
126
|
+
|
127
|
+
public static native long database_get_lastdocid(long dbid) throws XapianError;
|
128
|
+
|
129
|
+
public static native double database_get_avlength(long dbid) throws XapianError;
|
130
|
+
|
131
|
+
public static native int database_get_termfreq(long dbid, String term) throws XapianError;
|
132
|
+
|
133
|
+
public static native boolean database_term_exists(long dbid, String term) throws XapianError;
|
134
|
+
|
135
|
+
public static native int database_get_collection_freq(long dbid, String term) throws XapianError;
|
136
|
+
|
137
|
+
public static native double database_get_doclength(long dbid, long assigned_docid) throws XapianError;
|
138
|
+
|
139
|
+
public static native void database_keep_alive(long dbid) throws XapianError;
|
140
|
+
|
141
|
+
public static native long database_get_document(long dbid, long assigned_docid) throws XapianError, DocNotFoundError;
|
142
|
+
|
143
|
+
public static native void database_finalize(long dbid);
|
144
|
+
|
145
|
+
// writable-database functions
|
146
|
+
public static native long writabledatabase_new() throws XapianError;
|
147
|
+
|
148
|
+
public static native long writabledatabase_new(String path, int mode) throws XapianError;
|
149
|
+
|
150
|
+
public static native void writabledatabase_flush(long dbid) throws DatabaseError, DatabaseCorruptError, DatabaseLockError, XapianError;
|
151
|
+
|
152
|
+
public static native void writabledatabase_begin_transaction(long dbid) throws UnimplementedError, InvalidOperationError, XapianError;
|
153
|
+
|
154
|
+
public static native void writabledatabase_commit_transaction(long dbid) throws DatabaseError, DatabaseCorruptError, InvalidOperationError, UnimplementedError, XapianError;
|
155
|
+
|
156
|
+
public static native void writabledatabase_cancel_transaction(long dbid) throws DatabaseError, DatabaseCorruptError, InvalidOperationError, UnimplementedError, XapianError;
|
157
|
+
|
158
|
+
public static native long writabledatabase_add_document(long dbid, long docid) throws DatabaseError, DatabaseCorruptError, DatabaseLockError, XapianError;
|
159
|
+
|
160
|
+
public static native void writabledatabase_delete_document(long dbid, long assigned_docid) throws DatabaseError, DatabaseCorruptError, DatabaseLockError, XapianError;
|
161
|
+
|
162
|
+
public static native void writabledatabase_replace_document(long dbid, long assigned_docid, long docid) throws DatabaseError, DatabaseCorruptError, DatabaseLockError, XapianError;
|
163
|
+
|
164
|
+
public static native String writabledatabase_get_description(long dbid) throws XapianError;
|
165
|
+
|
166
|
+
public static native void writabledatabase_finalize(long dbid);
|
167
|
+
|
168
|
+
|
169
|
+
// document functions
|
170
|
+
public static native long document_new() throws XapianError;
|
171
|
+
|
172
|
+
public static native long document_new(long docid) throws XapianError;
|
173
|
+
|
174
|
+
public static native String docment_get_value(long docid, int value_index) throws XapianError;
|
175
|
+
|
176
|
+
public static native void document_add_value(long docid, int value_index, String value) throws XapianError, InvalidArgumentError;
|
177
|
+
|
178
|
+
public static native void document_remove_value(long docid, int value_index) throws XapianError, InvalidArgumentError;
|
179
|
+
|
180
|
+
public static native void document_clear_values(long docid) throws XapianError;
|
181
|
+
|
182
|
+
public static native String document_get_data(long docid) throws XapianError;
|
183
|
+
|
184
|
+
public static native void document_set_data(long docid, String data) throws XapianError, InvalidArgumentError;
|
185
|
+
|
186
|
+
public static native void document_add_posting(long docid, String term, int position) throws XapianError, InvalidArgumentError;
|
187
|
+
|
188
|
+
public static native void document_add_term(long docid, String term) throws XapianError, InvalidArgumentError;
|
189
|
+
|
190
|
+
/*
|
191
|
+
* For compatibility with older code.
|
192
|
+
* @deprecated use document_add_term instead
|
193
|
+
*/
|
194
|
+
public static void document_add_term_nopos(long docid, String term) throws XapianError, InvalidArgumentError {
|
195
|
+
document_add_term(docid, term);
|
196
|
+
}
|
197
|
+
|
198
|
+
public static native void document_remove_posting(long docid, String term, int position) throws XapianError, InvalidArgumentError;
|
199
|
+
|
200
|
+
public static native void document_remove_term(long docid, String term) throws XapianError, InvalidArgumentError;
|
201
|
+
|
202
|
+
public static native void document_clear_terms(long docid) throws XapianError;
|
203
|
+
|
204
|
+
public static native int document_termlist_count(long docid) throws XapianError;
|
205
|
+
|
206
|
+
public static native int document_values_count(long docid) throws XapianError;
|
207
|
+
|
208
|
+
public static native String document_get_description(long docid) throws XapianError;
|
209
|
+
|
210
|
+
public static native void document_finalize(long docid);
|
211
|
+
|
212
|
+
|
213
|
+
// mset functions
|
214
|
+
public static native int mset_convert_to_percent(long msetid, long other_msetid) throws XapianError;
|
215
|
+
|
216
|
+
public static native int mset_convert_to_percent(long msetid, double weight) throws XapianError;
|
217
|
+
|
218
|
+
public static native int mset_get_termfreq(long msetid, String term) throws XapianError, InvalidArgumentError;
|
219
|
+
|
220
|
+
public static native double mset_get_termweight(long msetid, String term) throws XapianError, InvalidArgumentError;
|
221
|
+
|
222
|
+
public static native int mset_get_firstitem(long msetid) throws XapianError;
|
223
|
+
|
224
|
+
public static native int mset_get_matches_lower_bound(long msetid) throws XapianError;
|
225
|
+
|
226
|
+
public static native int mset_get_matches_estimated(long msetid) throws XapianError;
|
227
|
+
|
228
|
+
public static native int mset_get_matches_upper_bound(long msetid) throws XapianError;
|
229
|
+
|
230
|
+
public static native double mset_get_max_possible(long msetid) throws XapianError;
|
231
|
+
|
232
|
+
public static native double mset_get_max_attained(long msetid) throws XapianError;
|
233
|
+
|
234
|
+
public static native int mset_size(long msetid) throws XapianError;
|
235
|
+
|
236
|
+
public static native boolean mset_empty(long msetid) throws XapianError;
|
237
|
+
|
238
|
+
public static native long mset_begin(long msetid) throws XapianError;
|
239
|
+
|
240
|
+
public static native long mset_end(long msetid) throws XapianError;
|
241
|
+
|
242
|
+
public static native long mset_back(long msetid) throws XapianError;
|
243
|
+
|
244
|
+
public static native long mset_element(long msetid, long index) throws XapianError;
|
245
|
+
|
246
|
+
public static native String mset_get_description(long msetid) throws XapianError;
|
247
|
+
|
248
|
+
public static native void mset_finalize(long msetid);
|
249
|
+
|
250
|
+
// mset iterator functions
|
251
|
+
public static native long msetiterator_get_document(long msetiteratorid) throws XapianError, DocNotFoundError;
|
252
|
+
|
253
|
+
public static native int msetiterator_get_rank(long msetiteratorid) throws XapianError;
|
254
|
+
|
255
|
+
public static native double msetiterator_get_weight(long msetiteratorid) throws XapianError;
|
256
|
+
|
257
|
+
public static native int msetiterator_get_collapse_count(long msetiteratorid) throws XapianError;
|
258
|
+
|
259
|
+
public static native int msetiterator_get_percent(long msetiteratorid) throws XapianError;
|
260
|
+
|
261
|
+
public static native String msetiterator_get_description(long msetiteratorid) throws XapianError;
|
262
|
+
|
263
|
+
public static native void msetiterator_prev(long msetiteratorid) throws XapianError;
|
264
|
+
|
265
|
+
public static native void msetiterator_next(long msetiteratorid) throws XapianError;
|
266
|
+
|
267
|
+
public static native long msetiterator_get_db_docid(long msetiteratorid) throws XapianError;
|
268
|
+
|
269
|
+
public static native boolean msetiterator_equals(long a, long b) throws XapianError;
|
270
|
+
|
271
|
+
public static native void msetiterator_finalize(long msetiteratorid);
|
272
|
+
|
273
|
+
|
274
|
+
// term iterator functions
|
275
|
+
public static native void termiterator_next(long termiteratorid) throws XapianError;
|
276
|
+
|
277
|
+
public static native String termiterator_get_termname(long termiteratorid) throws XapianError;
|
278
|
+
|
279
|
+
public static native int termiterator_get_term_freq(long termiteratorid) throws XapianError;
|
280
|
+
|
281
|
+
public static native long termiterator_get_wdf(long termiteratorid) throws XapianError;
|
282
|
+
|
283
|
+
public static native void termiterator_skip_to(long termiteratorid, String term) throws XapianError;
|
284
|
+
|
285
|
+
public static native String termiterator_get_description(long termiteratorid) throws XapianError;
|
286
|
+
|
287
|
+
public static native long termiterator_positionlist_begin(long termiteratorid) throws XapianError;
|
288
|
+
|
289
|
+
public static native long termiterator_positionlist_end(long termiteratorid) throws XapianError;
|
290
|
+
|
291
|
+
public static native boolean termiterator_equals(long a, long b) throws XapianError;
|
292
|
+
|
293
|
+
public static native void termiterator_finalize(long termiteratorid);
|
294
|
+
|
295
|
+
// query functions
|
296
|
+
public static native long query_new() throws XapianError;
|
297
|
+
|
298
|
+
public static native long query_new(String term) throws XapianError;
|
299
|
+
|
300
|
+
public static native long query_new(String term, int wqf) throws XapianError;
|
301
|
+
|
302
|
+
public static native long query_new(String term, int wqf, int pos) throws XapianError;
|
303
|
+
|
304
|
+
public static native long query_new(int operator, long left, long right) throws XapianError;
|
305
|
+
|
306
|
+
public static native long query_new(int operator, String left, String right) throws XapianError;
|
307
|
+
|
308
|
+
public static native long query_new(int operator, String[] terms) throws XapianError;
|
309
|
+
|
310
|
+
public static native long query_new(int operator, long[] queries) throws XapianError;
|
311
|
+
|
312
|
+
public static native long query_new(int operator, long id) throws XapianError;
|
313
|
+
|
314
|
+
public static native String query_get_description(long id) throws XapianError;
|
315
|
+
|
316
|
+
public static native boolean query_empty(long id) throws XapianError;
|
317
|
+
|
318
|
+
public static native long query_terms_begin(long id) throws XapianError;
|
319
|
+
|
320
|
+
public static native long query_terms_end(long id) throws XapianError;
|
321
|
+
|
322
|
+
public static native long query_get_length(long id) throws XapianError;
|
323
|
+
|
324
|
+
public static native void query_finalize(long id);
|
325
|
+
|
326
|
+
// enquire functions
|
327
|
+
public static native long enquire_new(long dbid) throws XapianError;
|
328
|
+
|
329
|
+
public static native void enquire_set_query(long eid, long queryid) throws XapianError;
|
330
|
+
|
331
|
+
public static native void enquire_set_query(long eid, long queryid, int qlen) throws XapianError;
|
332
|
+
|
333
|
+
// We implement get_query in Java and don't use JNI or C++ at all for it.
|
334
|
+
// public static native long enquire_get_query(long eid) throws XapianError;
|
335
|
+
// public static native void enquire_set_weighting_scheme(long eid, long weightid) throws XapianError;
|
336
|
+
public static native void enquire_set_collapse_key(long eid, long collapse_key) throws XapianError;
|
337
|
+
|
338
|
+
public static native void enquire_set_sort_forward(long eid, boolean forward) throws XapianError;
|
339
|
+
|
340
|
+
public static native void enquire_set_cutoff(long eid, int percent_cutoff, double weight_cutoff) throws XapianError;
|
341
|
+
|
342
|
+
public static native void enquire_set_sorting(long eid, long sort_key, int sort_bands) throws XapianError;
|
343
|
+
|
344
|
+
public static native long enquire_get_mset(long eid, long first, long maxitems, long rsetid, MatchDecider md) throws XapianError;
|
345
|
+
|
346
|
+
public static native long enquire_get_eset(long eid, long maxitems, long rsetid, int flags, double k, ExpandDecider ed) throws XapianError;
|
347
|
+
|
348
|
+
public static native long enquire_get_eset(long eid, long maxitems, long rsetid, ExpandDecider ed) throws XapianError;
|
349
|
+
|
350
|
+
public static native long enquire_get_matching_terms_begin(long eid, long dbdocid) throws XapianError;
|
351
|
+
|
352
|
+
public static native long enquire_get_matching_terms_end(long eid, long dbdocid) throws XapianError;
|
353
|
+
|
354
|
+
public static native long enquire_get_matching_terms_begin_by_msetiterator(long eid, long msetiteratorid) throws XapianError;
|
355
|
+
|
356
|
+
public static native long enquire_get_matching_terms_end_by_msetiterator(long eid, long msetiteratorid) throws XapianError;
|
357
|
+
|
358
|
+
public static native void enquire_register_match_decider(long eid, String name, MatchDecider md) throws XapianError;
|
359
|
+
|
360
|
+
public static native String enquire_get_description(long eid) throws XapianError;
|
361
|
+
|
362
|
+
public static native void enquire_finalize(long eid);
|
363
|
+
|
364
|
+
// rset functions
|
365
|
+
public static native long rset_new() throws XapianError;
|
366
|
+
|
367
|
+
public static native long rset_size(long rsetid) throws XapianError;
|
368
|
+
|
369
|
+
public static native boolean rset_empty(long rsetid) throws XapianError;
|
370
|
+
|
371
|
+
public static native void rset_add_document(long rsetid, long dbdocid) throws XapianError;
|
372
|
+
|
373
|
+
public static native void rset_add_document_via_msetiterator(long rsetid, long msetiteratorid) throws XapianError;
|
374
|
+
|
375
|
+
public static native void rset_remove_document(long rsetid, long dbdocid) throws XapianError;
|
376
|
+
|
377
|
+
public static native void rset_remove_document_via_msetiterator(long rsetid, long msetiteratorid) throws XapianError;
|
378
|
+
|
379
|
+
public static native boolean rset_contains(long rsetid, long dbdocid) throws XapianError;
|
380
|
+
|
381
|
+
public static native boolean rset_contains_via_msetiterator(long rsetid, long msetiteratorid) throws XapianError;
|
382
|
+
|
383
|
+
public static native String rset_get_description(long rsetid) throws XapianError;
|
384
|
+
|
385
|
+
public static native void rset_finalize(long rsetid);
|
386
|
+
|
387
|
+
// eset functions
|
388
|
+
public static native long eset_new() throws XapianError;
|
389
|
+
|
390
|
+
public static native long eset_get_ebound(long esetid) throws XapianError;
|
391
|
+
|
392
|
+
public static native long eset_size(long esetid) throws XapianError;
|
393
|
+
|
394
|
+
public static native boolean eset_empty(long esetid) throws XapianError;
|
395
|
+
|
396
|
+
public static native long eset_begin(long esetid) throws XapianError;
|
397
|
+
|
398
|
+
public static native long eset_end(long esetid) throws XapianError;
|
399
|
+
|
400
|
+
public static native String eset_get_description(long esetid) throws XapianError;
|
401
|
+
|
402
|
+
public static native void eset_finalize(long esetid);
|
403
|
+
|
404
|
+
// esetiterator functions
|
405
|
+
public static native long esetiterator_new() throws XapianError;
|
406
|
+
|
407
|
+
public static native void esetiterator_prev(long esetiteratorid) throws XapianError;
|
408
|
+
|
409
|
+
public static native void esetiterator_next(long esetiteratorid) throws XapianError;
|
410
|
+
|
411
|
+
public static native boolean esetiterator_equals(long a, long b) throws XapianError;
|
412
|
+
|
413
|
+
public static native String esetiterator_get(long esetiteratorid) throws XapianError;
|
414
|
+
|
415
|
+
public static native double esetiterator_get_weight(long esetiteratorid) throws XapianError;
|
416
|
+
|
417
|
+
public static native String esetiterator_get_description(long esetiteratorid) throws XapianError;
|
418
|
+
|
419
|
+
public static native void esetiterator_finalize(long esetiteratorid);
|
420
|
+
|
421
|
+
// stem functions
|
422
|
+
public static native long stem_new() throws XapianError;
|
423
|
+
|
424
|
+
public static native long stem_new(String language) throws XapianError;
|
425
|
+
|
426
|
+
public static native String stem_stem_word(long stemid, String word) throws XapianError;
|
427
|
+
|
428
|
+
public static native String stem_get_description(long stemid) throws XapianError;
|
429
|
+
|
430
|
+
public static native String stem_get_available_languages() throws XapianError;
|
431
|
+
|
432
|
+
public static native void stem_finalize(long stemid);
|
433
|
+
|
434
|
+
// position iterator functions
|
435
|
+
public static native long positioniterator_getvalue(long id) throws XapianError;
|
436
|
+
|
437
|
+
public static native void positioniterator_next(long id) throws XapianError;
|
438
|
+
|
439
|
+
public static native boolean positioniterator_equals(long a, long b) throws XapianError;
|
440
|
+
|
441
|
+
public static native String positioniterator_get_description(long id) throws XapianError;
|
442
|
+
|
443
|
+
public static native void positioniterator_finalize(long id);
|
444
|
+
}
|