- # Matching for tags column
- if type and value
- cond_tags = ['tags LIKE ? OR tags LIKE ? OR tags LIKE ? OR tags LIKE ?',
- ''+type+'='+value+'',
- ''+type+'='+value+';%',
- '%;'+type+'='+value+';%',
- '%;'+type+'='+value+'' ]
- elsif type
- cond_tags = ['tags LIKE ? OR tags LIKE ?',
- ''+type+'=%',
- '%;'+type+'=%' ]
- elsif value
- cond_tags = ['tags LIKE ? OR tags LIKE ?',
- '%='+value+';%',
- '%='+value+'' ]
+ # Matching for node tags table
+ if do_nodes
+ nodes = Node.joins(:node_tags)
+ nodes = nodes.where(:current_node_tags => { :k => type }) if type
+ nodes = nodes.where(:current_node_tags => { :v => value }) if value
+ nodes = nodes.limit(100)