[Xapian-discuss] Database Compatibility

Aleph Thomas alepht at gmail.com
Fri Nov 23 14:33:23 GMT 2007


That I need is that use Java create the database and search from php,
I search in the database created in java but not give me any result...

// here is the java code, maybe is that the dabase created is quartz,
can be changed to flint?

// create or *overwrite an existing* Xapian (quartz) database
        String dbpath = args[0];
        WritableDatabase db = new WritableDatabase(dbpath,
Xapian.DB_CREATE_OR_OPEN);

        // walk through remaining command-line arguments and
        // add each argument as a single to term to a new document.
        for (int x = 1; x < args.length; x++) {

            String term = args[x];
            Document doc = new Document();

            doc.addTerm(term);
            doc.addPosting(term, doc.getTermListCount());
            doc.addPosting(term, doc.getTermListCount());
            doc.addPosting(term, doc.getTermListCount());

            Stem stem = new Stem("english");

            doc.addPosting(stem.stemWord("is"), 0);
            doc.addPosting(stem.stemWord("is"), 0);
    	    doc.addPosting(stem.stemWord("there"), 2);
    	    doc.addPosting(stem.stemWord("anybody"), 3);
    	    doc.addPosting(stem.stemWord("out"), 4);
    	    doc.addPosting(stem.stemWord("there"), 5);

            doc.setData("codeID=4");

            db.addDocument(doc);



More information about the Xapian-discuss mailing list