First avoid query_post
it is horrendously bad practice, and never grab 's' via GET
. Read this before continuing:
http://www.slideshare.net/andrewnacin/you-dont-know-query-wordcamp-netherlands-2012
It's a set fo slides for a presentation that will teach you the correct way to make and modify queries in WordPress, and it's written by a Core developer. It should be considered essential reading for anyone working with WordPress and it will save you time and money.
Back to the search issue. A URL such as this will do what you desire:
example.com/?s=searchterm&post_type=companies
So the problem is how to replicate it in a search form. Your search form should be something like:
<form action="<?php home_url(); ?>" method="get">
<input type="text" name="s" /><?php /* your search term */ ?>
<input type="hidden" name="post_type" value="companies" /><?php /* set post type */ ?>
<input type="submit" /><?php /* submit button */ ?>
</form>
You should make no modifications to search.php
as WordPress will handle that part for you internally.
You should also verify you have posts of type 'companies' to search, and that the search term is there. Devise a test, where you search for X and post Y shows up, and you know for a fact that Y has that search term.