search_encode: first working version

Signed-off-by: Charles Joly Beauparlant <Charles.Joly-Beauparlant@crchul.ulaval.ca>
search_encode: Fixed a bug that caused entry with no treatment to be duplicated

Signed-off-by: Charles Joly Beauparlant <Charles.Joly-Beauparlant@crchul.ulaval.ca>