dimanche 6 septembre 2015

sqlite weight the matches in full text search

I have a fts3 table like this:

 CREATE VIRTUAL TABLE docs USING fts3(id, title, body);

I want to make weight the matches in title higher than those in content like this question

What I did:

    SELECT    
          case when title match 'word' then 1 else 0 end as titleRank,  
          case when body match 'word' then 1 else 0 end as contentRank      
          docs.*  
    FROM  docs  
    WHERE title match 'word' OR body match 'word'
    ORDER BY titleRank desc, contentRank desc

But seems the select case doesn't work with full text search (I use this tool, there is no error, no response from this query, but if I remove select case, it works)

Where am I wrong?

Aucun commentaire:

Enregistrer un commentaire