r4 - 26 May 2004 - 23:48:42 - LeoGalambosYou are here: TWiki >  Egothor Web  >  EgothorFAQ > SearchingAPI

Problem

How can I search an index via API?

Solution

import org.egothor.dir.TankerImpl;
import org.egothor.query.Executor;
import org.egothor.data.*;

public class Search {
    public static void main(String[] args) throws Exception {
        TankerImpl index = new TankerImpl("index/",false,32,10);

        QueryResponse qr = Executor.query(
            0,  // hits starting at this offset position
            10, // number of hits to get
            1,  // 1 = vector model, >10 boolean model, else fuzzy model
            "is",       //      query
            index);

        System.out.println("Hits total "+qr.getWouldBe()+
            ", returned "+qr.getEnumerationLength());
        java.util.Enumeration e = qr.getEnumeration();
        while (e.hasMoreElements()) {
            System.out.println(e.nextElement().toString());
        }

        index.close();
    }
}

See: IndexingAPI

-- LeoGalambos - 15 Mar 2004

WebForm?
TopicClassification PublicFAQ
OperatingSystem

OsVersion

Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r4 < r3 < r2 < r1 | More topic actions
Know.SearchingAPI moved from Know.Searching on 16 Mar 2004 - 17:14 by LeoGalambos
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback