would it be possible in postgres to get a count of sql hits on a select statement Say I have the following table in Postgres 9.4:

items 
id |  name             |   tag_ids
1     tire                  -1--2-
2     wheel                 -1--3-
3     transmisson           -3-


I'd like to do something like:

select id, tags from items where tag_ids ilike '%-1-%' or tags ilike '%-3-%';


but if it hit twice (like id 2), return a count of hits. Would this be possible? Or possibly have it come back 
as two records and then process in application code.

edit

ok, so assuming we had a second table like this:

items_tags
item_id  tag_id
1         1
1         2
2         1
2         3
3         3


Is there a way to join them and then group by the number of "hits" - I guess just selected rows and then order in reverse? And give a represntation of the hit tag_ids

select i.name from items inner join items_tags using (id) where items_tags.tag_id in (1,3);


but how would I do a count and order. I'm assuming a group by but this is beyond me.  

edit 2

so I can't get this second query to work. It seems like it should but isn't:

select tag_ids, (tag_ids ilike '%-1-%')::int + (tag_ids ilike '%-11-%')::int as hits 
from items order by  hits desc;   


saying ERROR:  column "hits" does not exist

select tag_ids, (tag_ids ilike '%-1-%')::int + (tag_ids ilike '%-11-%')::int
as hits from items where hits &gt; 0 order by  hits desc;
Yes, you can use this in the select list:

 (case when tags ilike '%-1-%' then 1 else 0 end) 
 + (case when tags ilike '%-3-%' then 1 else 0 end) 
   as hits 


or alternatively (convert the boolean values to integers (TRUE -&gt; 1, FALSE -&gt; 0) and then add:

 (tags ilike '%-1-%')::int + (tags ilike '%-3-%')::int
   as hits 


But the query (and many others) would be much easier if you normalized the design and store the item-tag relationship in a separate, junction table.