Skip to content

Commit

Permalink
SRU: fix search
Browse files Browse the repository at this point in the history
* Fixes ALL and ANY searches.
* Fixes 'dc.contributor' and 'dc.creator' searches.

Co-Authored-by: Peter Weber <[email protected]>
  • Loading branch information
2 people authored and iGor milhit committed Aug 26, 2021
1 parent 1bf9629 commit 5b161b7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions rero_ils/modules/sru/cql_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
'ape OR aqt OR arc OR art OR aus OR aut OR chr OR cll OR cmp OR com OR '
'drt OR dsr OR enj OR fmk OR inv OR ive OR ivr OR lbt OR lsa OR lyr OR '
'pht OR pra OR prg OR rsp OR scl) AND '
'contribution.agent.authorized_access_point',
'authorized_access_point',
'dc.creator': 'contribution.role:('
'abr OR act OR adi OR adp OR aft OR anm OR ann OR apl OR arr OR ato OR '
'auc OR aui OR bkd OR bnd OR brd OR brl OR bsl OR cas OR clr OR clt OR '
Expand All @@ -74,7 +74,7 @@
'rpc OR rsr OR sds OR sgd OR sll OR sng OR spk OR spn OR srv OR stl OR '
'tch OR tld OR tlp OR trc OR trl OR vac OR vdg OR wac OR wal OR wat OR '
'win OR wpr OR wst) AND '
'contribution.agent.authorized_access_point',
'authorized_access_point',
'dc.date': 'provisionActivity.type:"bf:Publication" '
'AND provisionActivity.startDate',
'dc.title': 'title._text.\\*',
Expand Down Expand Up @@ -404,7 +404,8 @@ def index_term(index, relation, term):
texts = []
for term in self.term.to_es().split(' '):
texts.append(index_term(index, relation, term))
texts[0] = texts[0].lstrip('"')
if texts:
texts[0] = texts[0].replace('"', '')
texts[-1] = texts[-1].rstrip('"')
if relation == 'any':
text = f'({" OR ".join(texts)})'
Expand Down

0 comments on commit 5b161b7

Please sign in to comment.