Add struct to keep copy of terms used by rtree

Each tree will create and keep and environment that will be destroy
in the tree destructor.