I'm building a plugin which goal is to expand default search by looking in OCR text (after having extracted that text using pdf2text).
For this plugin I'd like to add a link saying 'No more results in descriptions, continue your search inside these books'. My question is : what's the best way to detect :
- I'm on the last page
- I'm on a research page
Right now I checked that using values in Zend_Registry::get("pagination") : ['total_results'], ['per_page'] and ['page'] and calculating if I'm on the last page or not. I'm pretty sure there should be a more elegant solution but couldn't find.
To check if the current browsing page is the result of a search, I just check if $_GET["search"] is set. For that also, I think there should be a better way to do.
No emergency for these questions but if someone has ideas, I'd be interested.
Before going too far, have you seen the PDF Search plugin? Just want to check that you aren't duplicating work.
yes I had seen it (and my plugin is based on it;)). But I wanted to extract OCR in order to be able to use it in combination with Bookreader plugin ( https://github.com/jsicot/BookReader ) to allow searching inside a PDF and highlighting result. So I export XML from PDF instead of free text and I store the XML in local files, checking inside them with grep. It's not the best solution, I think storing XML in database as PDFSearch is doing would be better, and I wouldn't be obliged to load "full text results" in a second time.
Don't know if evertything is clear, but to summarize yes, I've seen this plugin and I should follow some of its principles.
Sounds great! And, off the top of my head, I don't know of a better way at your original question.