I am having a nightmare in building an efficient search query. I am using LINQ. The requirement is as follows:

In the application there is one text fox field which is used as a **Quick Search**.

The table I will be searching holds three fields **Make**, **Model** and **Extension**.

A typical keyword user can enter is like **Honda Accord XL**

Based on the keywords database should return me the matching rows and here the problem starts. There is no restriction on the order which keywords will be entered to prepare the phrase, i.e. one can enter **Accord XL Honda** or it could be like **XL Accord** or could just be **Honda**. In the example **Honda** is Make, **Accord** is the Model and **XL** is the extension.

Ideally the search result should only pull up perfect matches like if **Honda Accord** is entered it will not bring up other models from **Honda**. But the major problem is I don't know what they will enter and I have to look into three different columns of the table using `Contains` operator.

Here is what I tried:
I spit the phrase into words and place them in an array
`var arr = keyWord.Split(new [] {' '})`. Next step I build the query inside a loop of those array elements:

```
foreach (var k in arr)
{
   var item = new Vehicle();
   var arrayItem = k;
   var query = DataContext.Vehicles.Where(v =>v.RealName.Contains(arrayItem)
               || v.Model.Contains(arrayItem)
               || v.Style.Contains(arrayItem)).ToList();
   foreach (var v in query)
   {
     if(!result.Contains(v))
     result.Add(v);
   }
}

return result;

```

Now when the loop is executing and matching records for **Make** it already fills the list with say 250 items. But how can I remove unwanted items like when a record has **CT** as Model or **TYL** as Extension? If I knew the order of the words in which the keyword was created then I will have the option to remove unmatched Make, Model or Extension from the list by using one line of code for each and return the final result. But in this case if I have to do it I again have to use loop and remove unmatched items, even that will not probably give me the correct data. And definitely this is not the efficient way to do this.