On Nov 19, 2010, at 9:46 PM, Matthew Leffler wrote:

> A question:  Is is possible to group the data from the snippets() column in a 
> result?  The query would look something like the following (which doesn't 
> work):
> 
>>> SELECT snippet(search, '', '', '...') as extract, count() as count FROM 
>>> search WHERE content MATCH 'search term' GROUP BY extract ORDER BY count;
> 
> That would allow ordering by frequency of a given match snippet.

Do it in two steps perhaps?

select      result.extract as extract,
            count( * ) as count
from        (
                select  snippet( search, '', '', '...' ) as extract
                from    search 
                where   content match 'search term'
            )
as          result

group by    result.extract

order by    count desc

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to