# HG changeset patch # User Sylvain Thénault # Date 1278596193 -7200 # Node ID b962dff47c3629be5747f4d4f0be07b46aa9f07a # Parent f1abba8ccc01ff903c00e3a17407e70e11b3adc8 [ftirank] when ordered by fti rank, we don't want page navigation. Anyway, sorted nav component shouldn't consider has_text relation. diff -r f1abba8ccc01 -r b962dff47c36 selectors.py --- a/selectors.py Thu Jul 08 15:35:29 2010 +0200 +++ b/selectors.py Thu Jul 08 15:36:33 2010 +0200 @@ -202,6 +202,7 @@ from logilab.common.interface import implements as implements_iface from yams import BASE_TYPES +from rql.nodes import Function from cubicweb import (Unauthorized, NoSelectableObject, NotAnEntity, CW_EVENT_MANAGER, role) @@ -588,12 +589,17 @@ @lltrace def sorted_rset(cls, req, rset=None, **kwargs): """Return 1 for sorted result set (e.g. from an RQL query containing an - :ref:ORDERBY clause. + :ref:ORDERBY clause), with exception that it will return 0 if the rset is + 'ORDERBY FTIRANK(VAR)' (eg sorted by rank value of the has_text index). """ if rset is None: return 0 - rqlst = rset.syntax_tree() - if len(rqlst.children) > 1 or not rqlst.children[0].orderby: + selects = rset.syntax_tree().children + if (len(selects) > 1 or + not selects[0].orderby or + (isinstance(selects[0].orderby[0].term, Function) and + selects[0].orderby[0].term.name == 'FTIRANK') + ): return 0 return 2 diff -r f1abba8ccc01 -r b962dff47c36 web/views/navigation.py --- a/web/views/navigation.py Thu Jul 08 15:35:29 2010 +0200 +++ b/web/views/navigation.py Thu Jul 08 15:36:33 2010 +0200 @@ -132,7 +132,7 @@ if rel is None: continue attrname = rel.r_type - if attrname == 'is': + if attrname in ('is', 'has_text'): continue if not rschema(attrname).final: col = var.selected_index()