title: Comma separated Multiple keyword search
body: <p>I am using Web.py and sqlite3.I have a library catalog stored in database with following schema</p>
  
  <p><code>booklog(id,book_name,author,genre,language)</code></p>
  
  <p>I want to search through the database through a single text field.for eg if I type XYZ Ishould get all the results where XYZ occurs whether as author/book name/genre.I am getting this result with simple query with OR.The issue I have right now is when I want to search for multiple keywords separated by comma through the same textfield.the result should be with rows having both keywords followed by single keyword match.</p>
  
  <p>I am able to split the keywords in to  a list and search .but I am unable to sort the table with Descending no of matches ,also the collate nocase does not work in a list:</p>
  
  <pre><code> inp=web.input()
   key=inp.search.split(',')
   myvar=dict(t=key)
   result=db.query("select * from booklog where book_name in $t collate nocase or author in $t collate nocase or genre in $t collate nocase ",myvar)
   return render.bookview(result)
  </code></pre>
  
  <p>Is there any other way to do this in web.py??I am relatively new to python/web.py/sqlite3</p>