Inheritance: IDisposable
Esempio n. 1
0
 public TermIterator(TermIterator other) : this(XapianPINVOKE.new_TermIterator__SWIG_1(TermIterator.getCPtr(other)), true)
 {
     if (XapianPINVOKE.SWIGPendingException.Pending)
     {
         throw XapianPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 2
0
        public TermIterator MetadataKeysEnd()
        {
            TermIterator ret = new TermIterator(XapianPINVOKE.Database_MetadataKeysEnd__SWIG_1(swigCPtr), true);

            if (XapianPINVOKE.SWIGPendingException.Pending)
            {
                throw XapianPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 3
0
        public TermIterator MetadataKeysBegin(string prefix)
        {
            TermIterator ret = new TermIterator(XapianPINVOKE.Database_MetadataKeysBegin__SWIG_0(swigCPtr, prefix), true);

            if (XapianPINVOKE.SWIGPendingException.Pending)
            {
                throw XapianPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 4
0
        public TermIterator SynonymKeysEnd(string prefix)
        {
            TermIterator ret = new TermIterator(XapianPINVOKE.Database_SynonymKeysEnd__SWIG_0(swigCPtr, prefix), true);

            if (XapianPINVOKE.SWIGPendingException.Pending)
            {
                throw XapianPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 5
0
        public TermIterator SynonymKeysBegin()
        {
            TermIterator ret = new TermIterator(XapianPINVOKE.Database_SynonymKeysBegin__SWIG_1(swigCPtr), true);

            if (XapianPINVOKE.SWIGPendingException.Pending)
            {
                throw XapianPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 6
0
        public TermIterator SynonymsEnd(string arg0)
        {
            TermIterator ret = new TermIterator(XapianPINVOKE.Database_SynonymsEnd(swigCPtr, arg0), true);

            if (XapianPINVOKE.SWIGPendingException.Pending)
            {
                throw XapianPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 7
0
        public TermIterator SpellingsEnd()
        {
            TermIterator ret = new TermIterator(XapianPINVOKE.Database_SpellingsEnd(swigCPtr), true);

            if (XapianPINVOKE.SWIGPendingException.Pending)
            {
                throw XapianPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 8
0
        public TermIterator TermListEnd(uint did)
        {
            TermIterator ret = new TermIterator(XapianPINVOKE.Database_TermListEnd(swigCPtr, did), true);

            if (XapianPINVOKE.SWIGPendingException.Pending)
            {
                throw XapianPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 9
0
        public TermIterator UnstemEnd(string arg0)
        {
            TermIterator ret = new TermIterator(XapianPINVOKE.QueryParser_UnstemEnd(swigCPtr, arg0), true);

            if (XapianPINVOKE.SWIGPendingException.Pending)
            {
                throw XapianPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 10
0
        public TermIterator GetTermsBegin()
        {
            TermIterator ret = new TermIterator(XapianPINVOKE.Query_GetTermsBegin(swigCPtr), true);

            if (XapianPINVOKE.SWIGPendingException.Pending)
            {
                throw XapianPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 11
0
        public TermIterator TopValuesBegin(uint maxvalues)
        {
            TermIterator ret = new TermIterator(XapianPINVOKE.ValueCountMatchSpy_TopValuesBegin(swigCPtr, maxvalues), true);

            if (XapianPINVOKE.SWIGPendingException.Pending)
            {
                throw XapianPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 12
0
        public bool Equals(TermIterator other)
        {
            bool ret = XapianPINVOKE.TermIterator_Equals(swigCPtr, TermIterator.getCPtr(other));

            if (XapianPINVOKE.SWIGPendingException.Pending)
            {
                throw XapianPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 13
0
        public TermIterator GetMatchingTermsEnd(uint did)
        {
            TermIterator ret = new TermIterator(XapianPINVOKE.Enquire_GetMatchingTermsEnd__SWIG_0(swigCPtr, did), true);

            if (XapianPINVOKE.SWIGPendingException.Pending)
            {
                throw XapianPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 14
0
        public TermIterator ValuesEnd()
        {
            TermIterator ret = new TermIterator(XapianPINVOKE.ValueCountMatchSpy_ValuesEnd(swigCPtr), true);

            if (XapianPINVOKE.SWIGPendingException.Pending)
            {
                throw XapianPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 15
0
        public TermIterator GetMatchingTermsEnd(MSetIterator i)
        {
            TermIterator ret = new TermIterator(XapianPINVOKE.Enquire_GetMatchingTermsEnd__SWIG_1(swigCPtr, MSetIterator.getCPtr(i)), true);

            if (XapianPINVOKE.SWIGPendingException.Pending)
            {
                throw XapianPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 16
0
        public TermIterator StopListEnd()
        {
            TermIterator ret = new TermIterator(XapianPINVOKE.QueryParser_StopListEnd(swigCPtr), true);

            if (XapianPINVOKE.SWIGPendingException.Pending)
            {
                throw XapianPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 17
0
        public TermIterator Next()
        {
            TermIterator ret = new TermIterator(XapianPINVOKE.TermIterator_Next(swigCPtr), true);

            if (XapianPINVOKE.SWIGPendingException.Pending)
            {
                throw XapianPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 18
0
        public TermIterator TermListEnd()
        {
            TermIterator ret = new TermIterator(XapianPINVOKE.Document_TermListEnd(swigCPtr), true);

            if (XapianPINVOKE.SWIGPendingException.Pending)
            {
                throw XapianPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 19
0
 public TermIterator TermListEnd()
 {
     TermIterator ret = new TermIterator(XapianPINVOKE.Document_TermListEnd(swigCPtr), true);
     if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Esempio n. 20
0
    public static void Main()
    {
        try {
            // Test the version number reporting functions give plausible
            // results.
            string v = "";
            v += Xapian.Version.Major();
            v += ".";
            v += Xapian.Version.Minor();
            v += ".";
            v += Xapian.Version.Revision();
            string v2 = Xapian.Version.String();
            if (v != v2)
            {
                System.Console.WriteLine("Unexpected version output (" + v + " != " + v2 + ")");
                System.Environment.Exit(1);
            }

            Xapian.Stem     stem = new Xapian.Stem("english");
            Xapian.Document doc  = new Xapian.Document();
            // Currently SWIG doesn't generate zero-byte clean code for
            // transferring strings between C# and C++.

            /*
             * doc.SetData("a\0b");
             * if (doc.GetData() == "a") {
             *  System.Console.WriteLine("GetData+SetData truncates at a zero byte");
             *  System.Environment.Exit(1);
             * }
             * if (doc.GetData() != "a\0b") {
             *  System.Console.WriteLine("GetData+SetData doesn't transparently handle a zero byte");
             *  System.Environment.Exit(1);
             * }
             */
            doc.SetData("is there anybody out there?");
            doc.AddTerm("XYzzy");
            doc.AddPosting(stem.Apply("is"), 1);
            doc.AddPosting(stem.Apply("there"), 2);
            doc.AddPosting(stem.Apply("anybody"), 3);
            doc.AddPosting(stem.Apply("out"), 4);
            doc.AddPosting(stem.Apply("there"), 5);

            Xapian.WritableDatabase db = Xapian.InMemory.Open();
            db.AddDocument(doc);
            if (db.GetDocCount() != 1)
            {
                System.Environment.Exit(1);
            }

            if (doc.TermListCount() != 5)
            {
                System.Environment.Exit(1);
            }
            int count             = 0;
            Xapian.TermIterator i = doc.TermListBegin();
            while (i != doc.TermListEnd())
            {
                ++count;
                ++i;
            }
            if (count != 5)
            {
                System.Environment.Exit(1);
            }

            // Check exception handling for Xapian::DocNotFoundError.
            try {
                Xapian.Document doc2 = db.GetDocument(2);
                System.Console.WriteLine("Retrieved non-existent document: " + doc2.ToString());
                System.Environment.Exit(1);
            } catch (System.Exception e) {
                // We expect DocNotFoundError
                if (e.Message.Substring(0, 16) != "DocNotFoundError")
                {
                    System.Console.WriteLine("Unexpected exception from accessing non-existent document: " + e.Message);
                    System.Environment.Exit(1);
                }
            }

            // Check QueryParser parsing error.
            try {
                Xapian.QueryParser qp = new Xapian.QueryParser();
                qp.ParseQuery("test AND");
                System.Console.WriteLine("Successfully parsed bad query");
                System.Environment.Exit(1);
            } catch (System.Exception e) {
                if (e.Message != "QueryParserError: Syntax: <expression> AND <expression>")
                {
                    System.Console.WriteLine("Exception string not as expected, got: '" + e.Message + "'");
                    System.Environment.Exit(1);
                }
            }

            {
                Xapian.QueryParser qp = new Xapian.QueryParser();
                // FIXME: It would be better if the (uint) cast wasn't required
                // here.
                qp.ParseQuery("hello world", (uint)Xapian.QueryParser.feature_flag.FLAG_BOOLEAN);
            }

            if (Xapian.Query.MatchAll.GetDescription() != "Xapian::Query(<alldocuments>)")
            {
                System.Console.WriteLine("Unexpected Query.MatchAll.toString()");
                System.Environment.Exit(1);
            }

            if (Xapian.Query.MatchNothing.GetDescription() != "Xapian::Query()")
            {
                System.Console.WriteLine("Unexpected Query.MatchNothing.toString()");
                System.Environment.Exit(1);
            }

            // Check that OP_ELITE_SET works (in 0.9.6 and earlier it had the
            // wrong value in C#).
            try {
                Xapian.Query foo  = new Xapian.Query(Xapian.Query.op.OP_OR, "hello", "world");
                Xapian.Query foo2 = new Xapian.Query(Xapian.Query.op.OP_ELITE_SET, foo, foo);
                foo = foo2; // Avoid "unused variable" warning.
            } catch (System.Exception e) {
                System.Console.WriteLine("Using OP_ELITE_SET cause exception '" + e.Message + "'");
                System.Environment.Exit(1);
            }

            // Feature test for MatchDecider.
            doc = new Xapian.Document();
            doc.SetData("Two");
            doc.AddPosting(stem.Apply("out"), 1);
            doc.AddPosting(stem.Apply("source"), 2);
            doc.AddValue(0, "yes");
            db.AddDocument(doc);

            Xapian.Query   query   = new Xapian.Query(stem.Apply("out"));
            Xapian.Enquire enquire = new Xapian.Enquire(db);
            enquire.SetQuery(query);
            Xapian.MSet mset = enquire.GetMSet(0, 10, null, new TestMatchDecider());
            if (mset.Size() != 1)
            {
                System.Console.WriteLine("MatchDecider found " + mset.Size().ToString() + " documents, expected 1");
                System.Environment.Exit(1);
            }
            if (mset.GetDocId(0) != 2)
            {
                System.Console.WriteLine("MatchDecider mset has wrong docid in");
                System.Environment.Exit(1);
            }


            // Test setting and getting metadata
            if (db.GetMetadata("Foo") != "")
            {
                System.Console.WriteLine("db.GetMetadata(\"Foo\") returned wrong value \"" + db.GetMetadata("Foo") + "\" - expected \"\"");
                System.Environment.Exit(1);
            }
            db.SetMetadata("Foo", "Foo");
            if (db.GetMetadata("Foo") != "Foo")
            {
                System.Console.WriteLine("db.GetMetadata(\"Foo\") returned wrong value \"" + db.GetMetadata("Foo") + "\" - expected \"Foo\"");
                System.Environment.Exit(1);
            }

            // Test OP_SCALE_WEIGHT and corresponding constructor
            Xapian.Query query4 = new Xapian.Query(Xapian.Query.op.OP_SCALE_WEIGHT, new Xapian.Query("foo"), 5.0);
            if (query4.GetDescription() != "Xapian::Query(5 * foo)")
            {
                System.Console.WriteLine("Unexpected query4.GetDescription()");
                System.Environment.Exit(1);
            }
        } catch (System.Exception e) {
            System.Console.WriteLine("Exception: " + e.ToString());
            System.Environment.Exit(1);
        }
    }
Esempio n. 21
0
 public TermIterator StopListBegin()
 {
     TermIterator ret = new TermIterator(XapianPINVOKE.QueryParser_StopListBegin(swigCPtr), true);
     if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Esempio n. 22
0
 internal static HandleRef getCPtr(TermIterator obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
Esempio n. 23
0
 public TermIterator(TermIterator other)
     : this(XapianPINVOKE.new_TermIterator__SWIG_1(TermIterator.getCPtr(other)), true)
 {
     if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
 }
Esempio n. 24
0
 public TermIterator Next()
 {
     TermIterator ret = new TermIterator(XapianPINVOKE.TermIterator_Next(swigCPtr), true);
     if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Esempio n. 25
0
 public TermIterator GetMatchingTermsEnd(MSetIterator i)
 {
     TermIterator ret = new TermIterator(XapianPINVOKE.Enquire_GetMatchingTermsEnd__SWIG_1(swigCPtr, MSetIterator.getCPtr(i)), true);
     if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Esempio n. 26
0
 public TermIterator GetMatchingTermsEnd(uint did)
 {
     TermIterator ret = new TermIterator(XapianPINVOKE.Enquire_GetMatchingTermsEnd__SWIG_0(swigCPtr, did), true);
     if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Esempio n. 27
0
 public TermIterator GetTermsEnd()
 {
     TermIterator ret = new TermIterator(XapianPINVOKE.Query_GetTermsEnd(swigCPtr), true);
     if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Esempio n. 28
0
 public TermIterator UnstemEnd(string arg0)
 {
     TermIterator ret = new TermIterator(XapianPINVOKE.QueryParser_UnstemEnd(swigCPtr, arg0), true);
     if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Esempio n. 29
0
 public TermIterator TermListEnd(uint did)
 {
     TermIterator ret = new TermIterator(XapianPINVOKE.Database_TermListEnd(swigCPtr, did), true);
     if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Esempio n. 30
0
 public TermIterator AllTermsBegin()
 {
     TermIterator ret = new TermIterator(XapianPINVOKE.Database_AllTermsBegin__SWIG_0(swigCPtr), true);
     if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Esempio n. 31
0
 public TermIterator ValuesEnd()
 {
     TermIterator ret = new TermIterator(XapianPINVOKE.ValueCountMatchSpy_ValuesEnd(swigCPtr), true);
     if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Esempio n. 32
0
 public TermIterator AllTermsEnd(string prefix)
 {
     TermIterator ret = new TermIterator(XapianPINVOKE.Database_AllTermsEnd__SWIG_1(swigCPtr, prefix), true);
     if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Esempio n. 33
0
 public TermIterator SynonymKeysBegin(string prefix)
 {
     TermIterator ret = new TermIterator(XapianPINVOKE.Database_SynonymKeysBegin__SWIG_0(swigCPtr, prefix), true);
     if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Esempio n. 34
0
 public TermIterator TopValuesBegin(uint maxvalues)
 {
     TermIterator ret = new TermIterator(XapianPINVOKE.ValueCountMatchSpy_TopValuesBegin(swigCPtr, maxvalues), true);
     if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Esempio n. 35
0
 internal static HandleRef getCPtr(TermIterator obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
Esempio n. 36
0
 public TermIterator SynonymKeysEnd()
 {
     TermIterator ret = new TermIterator(XapianPINVOKE.Database_SynonymKeysEnd__SWIG_1(swigCPtr), true);
     if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Esempio n. 37
0
 public bool Equals(TermIterator other)
 {
     bool ret = XapianPINVOKE.TermIterator_Equals(swigCPtr, TermIterator.getCPtr(other));
     if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Esempio n. 38
0
 public TermIterator SynonymsEnd(string arg0)
 {
     TermIterator ret = new TermIterator(XapianPINVOKE.Database_SynonymsEnd(swigCPtr, arg0), true);
     if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }