Refactored _query_from_search_node into two menthods.