Skip to content
This repository

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

Closed
spladug opened this Issue January 02, 2013 · 1 comment

3 participants

Neil Williams Keith Mitchell William Pyburn
Neil Williams
Owner

Example: http://www.reddit.com/search?q=)(

...
File './r2/lib/base.py', line 146 in __call__                                             
  res = WSGIController.__call__(self, environ, start_response)                            
File '/usr/lib/pymodules/python2.7/pylons/controllers/core.py', line 164 in __call__      
  response = self._dispatch_call()                                                        
File '/usr/lib/pymodules/python2.7/pylons/controllers/core.py', line 120 in _dispatch_call
  response = self._inspect_call(func)                                                     
File '/usr/lib/pymodules/python2.7/pylons/controllers/core.py', line 79 in _inspect_call  
  result = func(**args)                                                                   
File './r2/lib/validator/validator.py', line 176 in newfn                                 
  return fn(self, *a, **kw)                                                               
File './r2/controllers/reddit_base.py', line 550 in new_fn                                
  return fn(self, **kw)                                                                   
File './r2/lib/validator/validator.py', line 176 in newfn                                 
  return fn(self, *a, **kw)                                                               
File './r2/controllers/front.py', line 815 in GET_search                                  
  count=count)                                                                            
File './r2/controllers/front.py', line 875 in _search                                     
  res = listing.listing()                                                                 
File './r2/models/listing.py', line 72 in listing                                         
  self.things, prev, next, bcount, acount = self.get_items()                              
File './r2/models/listing.py', line 63 in get_items                                       
  builder_items = self.builder.get_items(*a, **kw)                                        
File './r2/models/builder.py', line 339 in get_items                                      
  self.init_query()                                                                       
File './r2/models/builder.py', line 510 in init_query                                     
  self.results = self.query.run()                                                         
File './r2/lib/cloudsearch.py', line 831 in run                                           
  results = self._run(_update=_update)                                                    
File './r2/lib/cloudsearch.py', line 856 in _run                                          
  _update=_update)                                                                        
File './r2/lib/cloudsearch.py', line 912 in _run_cached                                   
  faceting=faceting, record_stats=True)                                                   
File './r2/lib/cloudsearch.py', line 720 in basic_query                                   
  path = _encode_query(query, bq, faceting, size, start, rank, return_fields)             
File './r2/lib/cloudsearch.py', 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.

http://www.reddit.com/search?q=(
http://www.reddit.com/search?q=)

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
5365887
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.