improve api for indexing text