From 887b771fc742ffe361d8d585174ff1c6f0de2d13 Mon Sep 17 00:00:00 2001 From: EPortman <169073732+EPortman@users.noreply.github.com> Date: Wed, 11 Dec 2024 14:30:36 -0800 Subject: [PATCH] 24849 change request search back to being a search (#1630) --- api/namex/VERSION.py | 2 +- api/namex/resources/requests.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/api/namex/VERSION.py b/api/namex/VERSION.py index 7311807d2..dee93a905 100644 --- a/api/namex/VERSION.py +++ b/api/namex/VERSION.py @@ -1 +1 @@ -__version__ = '1.2.15' +__version__ = '1.2.16' diff --git a/api/namex/resources/requests.py b/api/namex/resources/requests.py index 699a0b49e..6a2cbe75c 100644 --- a/api/namex/resources/requests.py +++ b/api/namex/resources/requests.py @@ -388,12 +388,13 @@ def get(): example: query=NR3742302 or query=abcd """ data = [] - nr_num = request.args.get('query', '').strip().upper() + nr_num = '%' + request.args.get('query', '').strip().upper() + '%' + rows = request.args.get('rows', 10, type=int) try: # Find the NR only if it is not cancelled & not expired or if it has expired within a 60 day grace period. query = RequestDAO.query.filter( - RequestDAO.nrNum == nr_num, + RequestDAO.nrNum.like(nr_num), RequestDAO.stateCd != State.CANCELLED, or_( RequestDAO.stateCd != State.EXPIRED, @@ -404,7 +405,7 @@ def get(): lazyload('*'), eagerload(RequestDAO.names).load_only(Name.name), load_only(RequestDAO.id, RequestDAO.nrNum) - ) + ).limit(rows) result = query.all() data = [{ 'nrNum': nr.nrNum,