Added logic for unknown condition and value for metadata fields.

You can specify in the indextemplate.json file that a metadata field
should be indexed with a special "unknown" value if it is missing and/or
empty. Now this setting is actually used during indexing.
Made sure to always check .length() before using .charAt().