Query based on multiple keywords I have 5 nodes title with some keywords:


this is my node one with some keywords
this is my second title with some keywords
this is my another title with second keyword
this is my another title second keyword
this was my last node title


My search query is: "second title"

when i search with only title keyword, query return 2,3,4, and 5 well, but when i search second title, query return only 2. So, how can i extend my query to return nodes as 2,4,3 and 5 in the last position (since 5 has only one keyword match).

This is my query: 

$query = db_select('node', 'n')
         -&gt;fields('n')
         -&gt;condition('n.title', '%' . db_like($_GET['Keywords']) . '%', 'LIKE')
         -&gt;execute()
         -&gt;fetchAll();


Updated:
search keywords can more then 2 words, but query should return as much words matches.

please help!

thanks.
You want db_or().

$or = db_or()-&gt;condition('n.title', '%' . db_like('second') . '%', 'LIKE')-&gt;condition('n.title', '%' . db_like('title') . '%', 'LIKE');
$results = db_select('node', 'n')
  -&gt;fields('n')
  -&gt;condition($or)
  -&gt;execute()
  -&gt;fetchAll();