Changeset 1112


Ignore:
Timestamp:
17.07.2010 22:41:02 (19 months ago)
Author:
zmsdev
Message:

Added support for searching only whole words.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ZMS/trunk/_zcatalogmanager.py

    r1091 r1112  
    8181def search_quote(s, maxlen=255, tag='·'): 
    8282  # remove all tags. 
     83  s = re.sub( '<script((.|\n|\r|\t)*?)>((.|\n|\r|\t)*?)</script>', '', s) 
     84  s = re.sub( '<style((.|\n|\r|\t)*?)>((.|\n|\r|\t)*?)</style>', '', s) 
    8385  s = re.sub( '<((.|\n|\r|\t)*?)>', '', s) 
    8486  # limit characters. 
     
    617619    #  ZCatalogManager.getCatalogQueryString: 
    618620    # -------------------------------------------------------------------------- 
    619     def getCatalogQueryString(self, raw, option='AND'): 
     621    def getCatalogQueryString(self, raw, option='AND', only_words=False): 
    620622      qs = [] 
    621623      i = 0 
     
    628630              if len(raw_item) > 1: 
    629631                raw_item = raw_item.replace('-','* AND *') 
    630                 if not raw_item.endswith('*'): 
     632                if not only_words and not raw_item.endswith('*'): 
    631633                  raw_item += '*' 
    632634                if raw_item not in qs: 
Note: See TracChangeset for help on using the changeset viewer.