It is reported in a number of sources that Imam al-Bukhari (may Allah have mercy upon him) would shower and pray two raka’at before entering any Hadith into his authentic collection. Imam al-Bukhari (may Allah have mercy upon him) said:
مَا وَضَعْتُ فِي كِتَابِيَ ” الصَّحِيحِ ” حَدِيثًا إِلَّا اغْتَسَلْتُ قَبْلَ ذَلِكَ ، وَصَلَّيْتُ رَكْعَتَيْنِ
“I did not put in my book as-Saheeh a single Hadith except I showered before that and prayed two rak’at.” End quote. [It is reported in Tabaqaat al-Hanaabiilah (1/374), Tareekh Baghdad (2/9), Tahtheeb al-Asmaa wal-Lughaat (1/74/1), Wafiyaat al-‘Ayaan (4/190), Tahtheeb al-Kamaal (no. 1169), Tabaqaat by as-Subki (2/220), Muqaddimah al-Fath (pg. 490), and Siyaar ‘Alaam an-Nubala (12/402). It was graded Saheeh by Shaikh Yahya al-Hajuri and his nephew Hussain al-Hajuri (may Allah preserve them) in their checking of the book al-Hittah Fi Dhikr as-Sahaah as-Sittah (pg. 311)]
What is understood by these two raka’at is Istikhaarah and Allah knows best.
Faisal Ibn Abdul Qaadir Ibn Hassan