File tree Expand file tree Collapse file tree 1 file changed +1
-22
lines changed
openlibrary/plugins/worksearch Expand file tree Collapse file tree 1 file changed +1
-22
lines changed Original file line number Diff line number Diff line change @@ -803,28 +803,7 @@ def _is_expensive_search(self, i):
803803 bool: True if this is an expensive search, False otherwise
804804 """
805805 q = i .get ('q' , '' ).strip ()
806-
807- # Check for specialized Solr syntax patterns
808- expensive_patterns = [
809- r'language:' , # language: queries
810- r'\*:\*' , # Wildcard queries
811- r'[\[\{]' , # Range queries with [ or {
812- r'\bAND\b' , # Boolean operators
813- r'\bOR\b' ,
814- r'\bNOT\b' ,
815- ]
816-
817- for pattern in expensive_patterns :
818- if re .search (pattern , q , re .IGNORECASE ):
819- return True
820-
821- # Check for field-specific queries while excluding URL schemes
822- # Matches patterns like 'field:value' but not 'http://', 'https://', 'ftp://', 'mailto:'
823- if re .search (r'(?<![:/])\b(?!(?:https?|ftp|mailto)://)\w+:' , q , re .IGNORECASE ):
824- return True
825-
826- # Check if language filter is being used
827- return bool (i .get ('language' ))
806+ return any (term in q for term in ['ebook_access:' , 'language:' ])
828807
829808
830809def works_by_author (
You can’t perform that action at this time.
0 commit comments