Fix crash on searching.

I have moved page_id lookup to the line before the if block
where we construct the search page result. So when we lookup for
the document content using the page_id, it's available and the program
doesn't throw a segmentation fault.

https://bugzilla.gnome.org/show_bug.cgi?id=736312