Show More
@@ -107,5 +107,6 b' class SearchController(BaseRepoControlle' | |||||
107 | c.runtime = execution_time |
|
107 | c.runtime = execution_time | |
108 | c.cur_query = search_query |
|
108 | c.cur_query = search_query | |
109 | c.search_type = search_type |
|
109 | c.search_type = search_type | |
|
110 | c.searcher = searcher | |||
110 | # Return a rendered template |
|
111 | # Return a rendered template | |
111 | return render('/search/search.mako') |
|
112 | return render('/search/search.mako') |
@@ -1842,6 +1842,24 b' def journal_filter_help():' | |||||
1842 | ) |
|
1842 | ) | |
1843 |
|
1843 | |||
1844 |
|
1844 | |||
|
1845 | def search_filter_help(searcher): | |||
|
1846 | ||||
|
1847 | terms = '' | |||
|
1848 | return _( | |||
|
1849 | 'Example filter terms for `{searcher}` search:\n' + | |||
|
1850 | '{terms}\n' + | |||
|
1851 | 'Generate wildcards using \'*\' character:\n' + | |||
|
1852 | ' "repo_name:vcs*" - search everything starting with \'vcs\'\n' + | |||
|
1853 | ' "repo_name:*vcs*" - search for repository containing \'vcs\'\n' + | |||
|
1854 | '\n' + | |||
|
1855 | 'Optional AND / OR operators in queries\n' + | |||
|
1856 | ' "repo_name:vcs OR repo_name:test"\n' + | |||
|
1857 | ' "owner:test AND repo_name:test*"\n' + | |||
|
1858 | 'More: {search_doc}' | |||
|
1859 | ).format(searcher=searcher.name, | |||
|
1860 | terms=terms, search_doc=searcher.query_lang_doc) | |||
|
1861 | ||||
|
1862 | ||||
1845 | def not_mapped_error(repo_name): |
|
1863 | def not_mapped_error(repo_name): | |
1846 | flash(_('%s repository is not mapped to db perhaps' |
|
1864 | flash(_('%s repository is not mapped to db perhaps' | |
1847 | ' it was created or renamed from the filesystem' |
|
1865 | ' it was created or renamed from the filesystem' |
@@ -33,6 +33,8 b" default_location = '%(here)s/data/index'" | |||||
33 |
|
33 | |||
34 |
|
34 | |||
35 | class BaseSearch(object): |
|
35 | class BaseSearch(object): | |
|
36 | query_lang_doc = '' | |||
|
37 | ||||
36 | def __init__(self): |
|
38 | def __init__(self): | |
37 | pass |
|
39 | pass | |
38 |
|
40 |
@@ -61,7 +61,8 b' log = logging.getLogger(__name__)' | |||||
61 |
|
61 | |||
62 |
|
62 | |||
63 | class Search(BaseSearch): |
|
63 | class Search(BaseSearch): | |
64 |
|
64 | # this also shows in UI | ||
|
65 | query_lang_doc = 'http://whoosh.readthedocs.io/en/latest/querylang.html' | |||
65 | name = 'whoosh' |
|
66 | name = 'whoosh' | |
66 |
|
67 | |||
67 | def __init__(self, config): |
|
68 | def __init__(self, config): |
@@ -63,6 +63,7 b'' | |||||
63 | ${h.select('type',c.search_type,[('content',_('File contents')), ('commit',_('Commit messages')), ('path',_('File names')),],id='id_search_type')} |
|
63 | ${h.select('type',c.search_type,[('content',_('File contents')), ('commit',_('Commit messages')), ('path',_('File names')),],id='id_search_type')} | |
64 | <input type="submit" value="${_('Search')}" class="btn"/> |
|
64 | <input type="submit" value="${_('Search')}" class="btn"/> | |
65 | <br/> |
|
65 | <br/> | |
|
66 | ||||
66 | <div class="search-feedback-items"> |
|
67 | <div class="search-feedback-items"> | |
67 | % for error in c.errors: |
|
68 | % for error in c.errors: | |
68 | <span class="error-message"> |
|
69 | <span class="error-message"> | |
@@ -71,10 +72,16 b'' | |||||
71 | % endfor |
|
72 | % endfor | |
72 | </span> |
|
73 | </span> | |
73 | % endfor |
|
74 | % endfor | |
|
75 | <div class="field"> | |||
|
76 | <p class="filterexample" style="position: inherit" onclick="$('#search-help').toggle()">${_('Example Queries')}</p> | |||
|
77 | <pre id="search-help" style="display: none">${h.tooltip(h.search_filter_help(c.searcher))}</pre> | |||
|
78 | </div> | |||
|
79 | ||||
74 | <div class="field">${c.runtime}</div> |
|
80 | <div class="field">${c.runtime}</div> | |
75 | </div> |
|
81 | </div> | |
76 | </div> |
|
82 | </div> | |
77 | </div> |
|
83 | </div> | |
|
84 | ||||
78 | ${h.end_form()} |
|
85 | ${h.end_form()} | |
79 | <div class="search"> |
|
86 | <div class="search"> | |
80 | % if c.search_type == 'content': |
|
87 | % if c.search_type == 'content': |
General Comments 0
You need to be logged in to leave comments.
Login now