add Sort function by yubo
use output dir to store the indexing result