I am trying out big.mg4j on a very small corupus and trying querying in web interface.
Although query results appear on query page, when you click on query result link it gives an 404 error instead of showing the corresponding document.
I tried using just mg4j (not big.mg4j) but the problem exists with that also.
Is there a problem with http server code linked with mg4j??
Here is the code that I am using and the screenshots of the error.
package try.mg4j;
import it.unimi.di.big.mg4j.document.FileSetDocumentCollection;
import it.unimi.di.big.mg4j.query.Query;
import it.unimi.di.big.mg4j.tool.IndexBuilder;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.commons.io.FileUtils;
public class TryMg4j {
/**
* Indexes a directory of HTML document files.
* From command line, this can be run as
* mvn exec:java -Dexec.inClass="try.mg4j.TryMg4j"
* -Dexec.args="corpus index"
* Then visit http://localhost:4242/Query
*
* @param args [1]=/path/to/corpus/dir [2]=/path/to/index/dir
* @throws Exception
*/
public static void main(String args[]) throws Exception {
final String corpusPath = args[0], indexPath = args[1];
final File corpusDir = new File(corpusPath),
indexDir = new File(indexPath);
assert corpusDir.isDirectory() && indexDir.isDirectory();
Collection<File> docFiles =
FileUtils.listFiles(corpusDir, new String[]{"txt"}, false);
ArrayList<String> mg4jArgs = new ArrayList<String>();
mg4jArgs.add("-f");
mg4jArgs.add("it.unimi.di.big.mg4j.document.tika.TextDocumentFactory");
final File collectionFile = new File(indexDir, "corpus.collection");
mg4jArgs.add(collectionFile.getAbsolutePath());
for (File docFile : docFiles) {
mg4jArgs.add(docFile.getAbsolutePath());
}
FileSetDocumentCollection.main(mg4jArgs.toArray(new String[]{}));
IndexBuilder.main(new String[]{
"-S", collectionFile.getAbsolutePath(),
(new File(indexDir, "cs635")).getAbsolutePath()
});
Query.main(new String[]{
"-h", "-i", "it.unimi.di.big.mg4j.query.FileSystemItem",
"-c", collectionFile.getAbsolutePath(),
(new File(indexDir, "cs635-text")).getAbsolutePath()
});
}
}