A service robot has to be flexible and fast in order to solve a manipulation task in the human environment with differing start configurations, objects, obstacles and a restricted work space. Based on a sophisticated task model, which captures the relevant constraints and goals of a task, constrained motion planning can be used to generate robot trajectories autonomously with high generalization capabilities. The major drawbacks are high planning times and non-repeatability of the results. In this work, search heuristics, which restrict the search space during motion planning, are learned incrementally whenever the robot uses the task model to plan a solution. The number of learned search heuristics is restricted by using a combination of constrained motion planning and a fast local control algorithm to increase the number of situations, in which the search heuristic can be applied. The approach combines two major approaches in Programming by Demonstration (PbD), i.e. learning and goal-directed planning with a general task description and learning efficient encodings of low-level trajectories, in a consistent way.