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') ->fields('n') ->condition('n.title', '%' . db_like($_GET['Keywords']) . '%', 'LIKE') ->execute() ->fetchAll();
Updated: search keywords can more then 2 words, but query should return as much words matches.