Skip to content
This repository

Searching for `)(` string will result in a 500. #618

spladug opened this Issue January 02, 2013 · 1 comment

3 participants

Neil Williams Keith Mitchell William Pyburn
Neil Williams


File './r2/lib/', line 146 in __call__                                             
  res = WSGIController.__call__(self, environ, start_response)                            
File '/usr/lib/pymodules/python2.7/pylons/controllers/', line 164 in __call__      
  response = self._dispatch_call()                                                        
File '/usr/lib/pymodules/python2.7/pylons/controllers/', line 120 in _dispatch_call
  response = self._inspect_call(func)                                                     
File '/usr/lib/pymodules/python2.7/pylons/controllers/', line 79 in _inspect_call  
  result = func(**args)                                                                   
File './r2/lib/validator/', line 176 in newfn                                 
  return fn(self, *a, **kw)                                                               
File './r2/controllers/', line 550 in new_fn                                
  return fn(self, **kw)                                                                   
File './r2/lib/validator/', line 176 in newfn                                 
  return fn(self, *a, **kw)                                                               
File './r2/controllers/', line 815 in GET_search                                  
File './r2/controllers/', line 875 in _search                                     
  res = listing.listing()                                                                 
File './r2/models/', line 72 in listing                                         
  self.things, prev, next, bcount, acount = self.get_items()                              
File './r2/models/', line 63 in get_items                                       
  builder_items = self.builder.get_items(*a, **kw)                                        
File './r2/models/', line 339 in get_items                                      
File './r2/models/', line 510 in init_query                                     
  self.results =                                                         
File './r2/lib/', line 831 in run                                           
  results = self._run(_update=_update)                                                    
File './r2/lib/', line 856 in _run                                          
File './r2/lib/', line 912 in _run_cached                                   
  faceting=faceting, record_stats=True)                                                   
File './r2/lib/', line 720 in basic_query                                   
  path = _encode_query(query, bq, faceting, size, start, rank, return_fields)             
File './r2/lib/', line 773 in _encode_query                                 
  raise ValueError("Need query or bq")                                                    
ValueError: Need query or bq                                                              
William Pyburn

More minimally, searching for just an open or closed parenthesis breaks it.

Keith Mitchell kemitche referenced this issue from a commit January 03, 2013
Keith Mitchell Fix failed searches of just parentheses
If the query were just parentheses, like ")(",
l2cs.convert would return an empty string, causing
the subsequent search to fail. This moves the empty
query check later in the code to avoid that issue.

fixes reddit/reddit#618
Keith Mitchell kemitche closed this January 07, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.