tracker-sparql: Various improvements/fixes for --tree command line option

Specifically:
- Fix offset error when highlighting parts of the tree when -s is used
- Use GNode APIs g_node_traverse() to print and find nodes, reducing code size
- Remove unnecessary memory allocation for --get-longhand
- Fix memory leak of longhand to shorthand conversion in --tree
- Avoid memory allocations when generating filter hashtable