Attachment 'fullsearch.diff'

Download

   1 --- fullsearch.py	2009-06-24 23:11:03.000000000 +0200
   2 +++ fullsearch_new.py	2009-06-25 00:09:04.000000000 +0200
   3 @@ -6,6 +6,15 @@
   4  
   5      @copyright: 2001 by Juergen Hermann <jh@web.de>
   6      @license: GNU GPL, see COPYING for details.
   7 +
   8 +    Comments about my changes (MarcelHäfner / 24.06.2009):
   9 +    I wanted a search witch finds/displays only wiki pages (primary no attachments)
  10 +    For this I changed this action; so you can now add to our theme / html searchform 
  11 +    a hidden paramter like this:
  12 +    <input id="searchmimetype" type="hidden" value="text/wiki" name="mimetype"/> 
  13 +
  14 +    for more details, please see on MoinMoin this page: FullSearchMimeTypeSupport
  15 +
  16  """
  17  
  18  import re, time
  19 @@ -82,6 +91,7 @@
  20      mtime = None
  21      msg = ''
  22      historysearch = 0
  23 +    mimetype = request.form.get('mimetype', [0]) #moved up; from only used in advanced search 
  24  
  25      # if advanced search is enabled we construct our own search query
  26      if advancedsearch:
  27 @@ -92,7 +102,6 @@
  28          categories = request.form.get('categories', [''])
  29          timeframe = request.form.get('time', [''])[0].strip()
  30          language = request.form.get('language', [''])
  31 -        mimetype = request.form.get('mimetype', [0])
  32          excludeunderlay = request.form.get('excludeunderlay', [0])[0]
  33          nosystemitems = request.form.get('nosystemitems', [0])[0]
  34          historysearch = request.form.get('historysearch', [0])[0]
  35 @@ -157,6 +166,11 @@
  36              needle += '(%s) ' % ' '.join(['-%s' % t for t in word_re.findall(not_terms)])
  37          if or_terms:
  38              needle += '(%s) ' % ' or '.join(word_re.findall(or_terms))
  39 +    else:
  40 +        #added for mimetype search over the searchform
  41 +        if mimetype[0]:
  42 +            needle = 'mimetype:%s (%s)' % (','.join(mimetype), needle)
  43 +           
  44  
  45      # check for sensible search term
  46      stripped = needle.strip()

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2009-06-25 06:54:13, 114.2 KB) [[attachment:allmimetypes.png]]
  • [get | view] (2009-06-24 22:09:59, 1.8 KB) [[attachment:fullsearch.diff]]
  • [get | view] (2009-06-24 22:09:44, 10.9 KB) [[attachment:fullsearch_new-1.8.2-1.py]]
  • [get | view] (2009-06-24 22:09:33, 10.9 KB) [[attachment:fullsearch_new.py]]
  • [get | view] (2009-06-25 06:54:09, 97.3 KB) [[attachment:onlywikipages.png]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.