the way you are doing this is not correct.
dont add to cart based on the search.
instead, you should have a search page, a results page that shows the items returned by the search, the results page should have a link to the product details page to show details for that product.
use the data assist wizard to create the search results and details page.
then add an eCart add to cart button to the details page.