Fix globcnt is zero crash

I have hit this crash while trying to import a PST file.
Pull request went out to become somewhat big (I ended up here while trying to isolate while the crash).
The cherry on the top of the cake is actually the last patch - 13d7bbc1783d8348df7c63b2b062bedb2881a15e
(at least this fixed the problem for me)

It turned out we initializing TDB backend for Indexing while every other backend defaults to MySQL.
I this this is widely untested combination and also undesired :)

Please review!

Please also note that this pull request is superset for #90
So we should either merge this one and discard #90 OR merge #90 first and the I will clean up this
request to contain only distinct patches.
Sharp eye! Thanks @blaxter 

That's a good question - Location vs. Function

There should be an option for DEBUG macro to print location explicitly actually,
but I can't turn it 'on' (or 'off', as it looks like by reading the code).

For me, it was always more useful to have Location - especially in long run or if I don't know the code by heart (which is essentially same - in long run people tend to forget. Most people I mean ;-) And besides, my favorite editor is faster when opening files than finding symbols.

I will revert it to __FUNCTION__, so you are happy and look for how to enable __location__
in DEBUG() macro