Hello,
I am getting the following error when trying to call addIndex() on a QueryEnvironment object:
hereException in thread "main"
java.lang.Exception: ../src/Repository.cpp(482): Couldn't open a repository at '/Users/ENP/Documents/johnsHopkins_Scale/testIndex' because:
../src/Parameters.cpp(469): Couldn't open parameter file '/Users/ENP/Documents/johnsHopkins_Scale/testIndex/manifest' for reading.
at lemurproject.indri.indriJNI.IndexEnvironment_open__SWIG_1(Native Method)
at lemurproject.indri.IndexEnvironment.open(IndexEnvironment.java:279)
at tester.main(tester.java:25)
My code is below:
import lemurproject.indri.IndexEnvironment;
import lemurproject.indri.QueryEnvironment;
public class tester {
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
IndexEnvironment first = new IndexEnvironment();
first.create("/Users/ENP/Documents/johnsHopkins_Scale/testIndex");
String[] fields= new String[4];
//first.setMemory(4096);
fields[0]="DOCNO";
fields[1]="url";
fields[2]="headline";
fields[3]="text";
//first.setIndexedFields(fields);
first.setMetadataIndexedFields(fields,fields);
first.addFile("/Users/ENP/Documents/johnsHopkins_Scale/Pare/trecFormat.txt");
System.out.println(first.documentsIndexed());
System.out.println("here");
first.open("/Users/ENP/Documents/johnsHopkins_Scale/testIndex");
QueryEnvironment query = new QueryEnvironment();
query.addIndex("/Users/ENP/Documents/johnsHopkins_Scale/testIndex/");
System.out.println(query.documentCount());
// TODO Auto-generated method stub
}
}
The file I am testing with is atached which is located in:
/Users/ENP/Documents/johnsHopkins_Scale/trec/trecFormat.txt
The index opened in first has to be closed and written before you can open it again with the QueryEnvironment.
Thanks for the prompt response...I see a close() method in the indexEnvironment class but I don't see a write() method in the indexEnvironment class, is there anyway to view a simple sample program that creates an index and makes a simple query? If not can you advice how i write an index...
Thanks,
Eli
Close the index and it will be written.
The java applications for indexing and retrieval are in
swig/src/java/lemurproject/indri/ui/*
great, I think I have the basic usage down now. Thanks for the help.