Search bars handle queries as if they have a * at the end

Change-Id: Iac8a6a46e7898edd523e3f7c026cbdd134bbff21
Task: 2260
Signed-off-by: Riju19 <19.riju@gmail.com>
This commit is contained in:
Riju19 2019-03-19 11:42:41 +05:30
parent a834414372
commit a2a3df3d19
2 changed files with 7 additions and 2 deletions

View File

@ -1,6 +1,6 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
sphinx>=1.1.2
sphinx<2.0.0
sphinxcontrib-pecanwsme>=0.5
openstackdocstheme

View File

@ -29,7 +29,12 @@ class SqlAlchemySearchImpl(search_engine.SearchEngine):
def _build_fulltext_search(self, model_cls, query, q,
mode=FullTextMode.BOOLEAN):
return query.filter(FullTextSearch(q, model_cls, mode=mode))
boolean_search_operators = ['+', '-', '~', '<', '>']
if(q[0] in boolean_search_operators or (q[0] == '"' and q[-1] == '"')
or q[-1] == '*'):
return query.filter(FullTextSearch(q, model_cls, mode=mode))
return query.filter(FullTextSearch(q + '*', model_cls, mode=mode))
def _apply_pagination(self, model_cls, query, marker=None,
offset=None, limit=None, sort_field='id',