开发者

JackRabbit Search PDF File

开发者 https://www.devze.com 2023-02-25 00:23 出处:网络
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 bel

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消