[TASK] Various fixes and improvements

- flush operation correctly implemented
- optimize operation added
- sort and fulltext issues fixed