I have stumbled on this issue for about 3 months. Finally my efforts were paid off and found a solution.
The problem is, when you user "replace", this is equivalent to "remove and add". so the fragment is completely removed and recreated when back button is pressed. instead we have to hide the parent fragment and show the child.
Where serach fragment is called
ft = fm.beginTransaction();
ft.replace(R.id.main_fragment, yourSearchFragment, "searchFragment");
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
ft.commit();
When calling productDetails fragment
ft = fm.beginTransaction();
ft.hide(getFragmentManager().findFragmentByTag("searchFragment"));
ft.add(R.id.main_fragment, yourDetailfragment);
ft.addToBackStack(null);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
ft.commit();
Good luck