rewrite functions for term index