I have one document library and that library has multiple documents. I have two user groups like general and contributor group.  Some of the documents does not have permission to general user groups. So when general group users try to search that particular document then the documents are not listing out in search results. But search results return the documents when the user who has permission for the library.I need to list out all the documents in search result irrespective of the permission but i need to restrict the document at that time of opening the document from the search result. Can we achieve this functionality through  OOTB or custom code ? Can anyone please show some light on this issue.

solution:

This is by design.  I don’t think you are going to be able to do what you want, but you can definitely handle this using custom code.  You can use the search API or Web Service and then use an account with higher privileges.  With the API you would use the RunWithElevatedPrivileges delegate.  With the web service, you would just specify a different user account.