As the title says, is it possible for one to alter the search box using code? As currently the search box displays the files with results found, but for files with a lot of pages, and the preview starts from slide/page 1, i would like the preview to show which page(s) have the result, either as a sidebar message or drop down list or something similar.
Yes it is possible, depending which version of SharePoint you run the process will be a bit different in 2013 you can use display templates. Search in general can be greatly customised in SharePoint (on the far end you can write your own app that will just query the engine and return xml results that you can do whatever you want with it). Showing the page that actually has the keywords may be a bit more tricky. I don't think search index contains the page on which keyword is stored. The indexing process is building keyword vector that is used to match the searches so you would probably have to retrieve the document and perform another search inside using office api to get specific page. Here you will find all the baseline references: https://msdn.microsoft.com/en-us/library/office/jj163300.aspx