exprQuery optionally specifies the *SearchQuery prototype that was generated by parsing the search expression
(expr *SearchQuery)
| 139 | // exprQuery optionally specifies the *SearchQuery prototype that was generated |
| 140 | // by parsing the search expression |
| 141 | func (q *SearchQuery) plannedQuery(expr *SearchQuery) *SearchQuery { |
| 142 | pq := new(SearchQuery) |
| 143 | *pq = *q |
| 144 | if expr != nil { |
| 145 | pq.Constraint = expr.Constraint |
| 146 | if expr.Sort != 0 { |
| 147 | pq.Sort = expr.Sort |
| 148 | } |
| 149 | if expr.Limit != 0 { |
| 150 | pq.Limit = expr.Limit |
| 151 | } |
| 152 | } |
| 153 | if pq.Sort == UnspecifiedSort { |
| 154 | if pq.Constraint.onlyMatchesPermanode() { |
| 155 | pq.Sort = CreatedDesc |
| 156 | } |
| 157 | } |
| 158 | if pq.Limit == 0 { |
| 159 | pq.Limit = 200 // arbitrary |
| 160 | } |
| 161 | if err := pq.addContinueConstraint(); err != nil { |
| 162 | log.Printf("Ignoring continue token: %v", err) |
| 163 | } |
| 164 | pq.Constraint = optimizePlan(pq.Constraint) |
| 165 | return pq |
| 166 | } |
| 167 | |
| 168 | // For permanodes, the continue token is (currently!) |
| 169 | // of form "pn:nnnnnnn:sha1-xxxxx" where "pn" is a |