172 # reset uid_func so it don't try to get type from eids |
172 # reset uid_func so it don't try to get type from eids |
173 rqlhelper._analyser.uid_func = None |
173 rqlhelper._analyser.uid_func = None |
174 rqlhelper._analyser.uid_func_mapping = {} |
174 rqlhelper._analyser.uid_func_mapping = {} |
175 return rqlhelper |
175 return rqlhelper |
176 |
176 |
177 def _prepare_plan(self, rql, kwargs=None): |
177 def _prepare_plan(self, rql, kwargs=None, simplify=True): |
178 rqlhelper = self._rqlhelper() |
178 rqlhelper = self._rqlhelper() |
179 rqlst = rqlhelper.parse(rql) |
179 rqlst = rqlhelper.parse(rql) |
180 rqlhelper.compute_solutions(rqlst, kwargs=kwargs) |
180 rqlhelper.compute_solutions(rqlst, kwargs=kwargs) |
181 rqlhelper.simplify(rqlst) |
181 if simplify: |
|
182 rqlhelper.simplify(rqlst) |
182 for select in rqlst.children: |
183 for select in rqlst.children: |
183 select.solutions.sort() |
184 select.solutions.sort() |
184 return self.o.plan_factory(rqlst, kwargs, self.session) |
185 return self.o.plan_factory(rqlst, kwargs, self.session) |
185 |
186 |
186 def _prepare(self, rql, kwargs=None): |
187 def _prepare(self, rql, kwargs=None): |
187 plan = self._prepare_plan(rql, kwargs) |
188 plan = self._prepare_plan(rql, kwargs, simplify=False) |
188 plan.preprocess(plan.rqlst) |
189 plan.preprocess(plan.rqlst) |
189 rqlst = plan.rqlst.children[0] |
190 rqlst = plan.rqlst.children[0] |
190 rqlst.solutions = remove_unused_solutions(rqlst, rqlst.solutions, {}, self.repo.schema)[0] |
191 rqlst.solutions = remove_unused_solutions(rqlst, rqlst.solutions, {}, self.repo.schema)[0] |
191 return rqlst |
192 return rqlst |
192 |
193 |