Conditional query

Hello guys,

I want first to apologize for my bad english.

I need your help to build a conditionnal query.

I have documents with 3 information : name, descrption and type
If user search "ba", i need to find :
all doc with type 1 and contains "ba" in name AND all doc with type 2 and 3 and contains "ba" in description.

Exemple
Name Descrption type Id
Joba fooo 1 0
Jule baba 2 1
John haba 3 2
Tarf baba 1 3

The request must give me the doc with id 0, 1, 2 but not 3

I really need your help