I have been building a main navigation on the site and I would like to use search-index to query pages instead of using direct query. Could you please help me on how to accomplish this?
I'm not sure if I understand your question completely. But I'll give you my thoughts and let me know if you have any questions.
1) Sitefinity does index all pages when you publish a page. But if you want to index all pages, click 'run index' in the backend to trigger a search index update on all pages.
2) Whether or not question 1 is false, you can create a PageInboundPipe to customize how each page is scanned for search. Again, if you publish a page, that page is search scanned (or queried?) but instead of using Sitefinity's method, you can customize it using a custompageinbound pipe.
2b) If you add a custom pipe, you still go through all the pages of your site, the difference is using the pipe, you can test things like 'is this page a group page' or 'is this page a redirecting page' (I believe). If i'm wrong someone let me know. But the custom pipe allows you to make your own tests.
Thank you very much for your support. I understand that I can customize PageInboundPipe. However, when I create a redirecting page or a group page in back-end, it doesn't trigger this change and my customized code is not called. But for normal pages, it works properly.
Actually, I don't know why so. I have researched a lots but still stuck on this. Could you please advise on this?