JackRabbit Search PDF File
I am using Jackrabbit to do some basic file operations like add, delete, search, versioning and all. It was good until I got stuck with the search prob开发者_如何学JAVAlem in PDF file. Please find below my code that works fine with all other formats like word, xcel, plain text and not working for PDF file. The code is not giving any exception upon execution, it just does not give any result if I give a PDF File. Is it because my PDF file is not indexed?? Please help me.
Query query = queryManager.createQuery("select * from [nt:resource] AS resource where contains(resource.*, '%sampletext%')", Query.JCR_SQL2);
QueryResult result = query.execute();
RowIterator ri = result.getRows();
while (ri.hasNext()) {
Row row = ri.nextRow();
System.out.println("Row: " + row.toString());
}
Thanks in advance
I can think of 3 possible root causes:
Possibly the PDF file is not yet indexed at that time (fulltext indexing is done in a background thread AFAIK)
The pdf library (pdfbox) is not in the classpath
The pdf could not be indexes for some reason, in which case you would see a warning in the log file.
精彩评论