As far as I know, onCreateOptionsMenu is called during onCreate, but you enable options menu feature in the end of the method. Try to setHasOptionsMenu(true) in the constructor of the Fragment.
public YourFragment() {
this.setHasOptionsMenu(true);
}
To catch hardware search button press from the Activity
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_SEARCH) {
this.onSearchClicked();
return true;
}
return false;
}