Menu

#64 java api Indri exception - not opening manifest file for reading

v5.x
closed
None
1
2014-01-31
2013-06-14
Eli Pincus
No

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

1 Attachments

Discussion

  • David Fisher

    David Fisher - 2013-06-14

    The index opened in first has to be closed and written before you can open it again with the QueryEnvironment.

     
  • David Fisher

    David Fisher - 2013-06-14
    • status: open --> pending
    • assigned_to: David Fisher
     
  • Eli Pincus

    Eli Pincus - 2013-06-14

    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

     
  • David Fisher

    David Fisher - 2013-06-14

    Close the index and it will be written.

    The java applications for indexing and retrieval are in

    swig/src/java/lemurproject/indri/ui/*

     
  • Eli Pincus

    Eli Pincus - 2013-06-17

    great, I think I have the basic usage down now. Thanks for the help.

     
  • David Fisher

    David Fisher - 2013-06-18
    • status: pending --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB