Fixed the substr(...) method.

There are some places where `SearchIndex::substr($str, $pos, $length)` is used without `$length` parameter, thus resulting in fatal error.

The fix defaults `$length` to null and continues execution accordingly.