##// END OF EJS Templates
search: make better use of search tags...
dan -
r3446:dd151813 default
parent child Browse files
Show More
@@ -1,201 +1,214 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="/base/base.mako"/>
3 3
4 4 <%def name="title()">
5 5 %if c.repo_name:
6 6 ${_('Search inside repository {repo_name}').format(repo_name=c.repo_name)}
7 7 %elif c.repo_group_name:
8 8 ${_('Search inside repository group {repo_group_name}').format(repo_group_name=c.repo_group_name)}
9 9 %else:
10 10 ${_('Search inside all accessible repositories')}
11 11 %endif
12 12 %if c.rhodecode_name:
13 13 &middot; ${h.branding(c.rhodecode_name)}
14 14 %endif
15 15 </%def>
16 16
17 17 <%def name="breadcrumbs_links()">
18 18 %if c.repo_name:
19 19 ${_('Search inside repository {repo_name}').format(repo_name=c.repo_name)}
20 20 %elif c.repo_group_name:
21 21 ${_('Search inside repository group {repo_group_name}').format(repo_group_name=c.repo_group_name)}
22 22 %else:
23 23 ${_('Search inside all accessible repositories')}
24 24 %endif
25 25
26 26 </%def>
27 27
28 28 <%def name="menu_bar_nav()">
29 29 %if c.repo_name:
30 30 ${self.menu_items(active='search')}
31 31 %elif c.repo_group_name:
32 32 ${self.menu_items(active='search')}
33 33 %else:
34 34 ${self.menu_items(active='search')}
35 35 %endif
36 36 </%def>
37 37
38 38 <%def name="menu_bar_subnav()">
39 39 %if c.repo_name:
40 40 ${self.repo_menu(active='search')}
41 41 %elif c.repo_group_name:
42 42 ${self.repo_group_menu(active='search')}
43 43 %endif
44 44 </%def>
45 45
46 46 <%def name="main()">
47 47 <div class="box">
48 48 %if c.repo_name:
49 49 <!-- box / title -->
50 50 <div class="title">
51 51 ${self.repo_page_title(c.rhodecode_db_repo)}
52 52 </div>
53 53 ${h.form(h.route_path('search_repo',repo_name=c.repo_name),method='get')}
54 54 %elif c.repo_group_name:
55 55 <!-- box / title -->
56 56 <div class="title">
57 57 ${self.repo_group_page_title(c.repo_group)}
58 58 </div>
59 59 ${h.form(h.route_path('search_repo_group',repo_group_name=c.repo_group_name),method='get')}
60 60 %else:
61 61 <!-- box / title -->
62 62 <div class="title">
63 63 ${self.breadcrumbs()}
64 64 <ul class="links">&nbsp;</ul>
65 65 </div>
66 66 <!-- end box / title -->
67 67 ${h.form(h.route_path('search'), method='get')}
68 68 %endif
69 69 <div class="form search-form">
70 70 <div class="fields">
71 71
72 72 ${h.text('q', c.cur_query, placeholder="Enter query...")}
73 73
74 74 ${h.select('type',c.search_type,[('content',_('Files')), ('path',_('File path')),('commit',_('Commits'))],id='id_search_type')}
75 75 ${h.hidden('max_lines', '10')}
76 76
77 77 <input type="submit" value="${_('Search')}" class="btn"/>
78 78 <br/>
79 79
80 80 <div class="search-tags">
81 <span class="tag tag8">
81 82 %if c.repo_name:
82 <span class="tag tag-ok disabled">
83 <a href="${h.route_path('search', _query={'q': c.cur_query})}">${_('Global Search')}</a>
84 %elif c.repo_group_name:
85 <a href="${h.route_path('search', _query={'q': c.cur_query})}">${_('Global Search')}</a>
86 % else:
87 ${_('Global Search')}
88 %endif
89 </span>
90
91 %if c.repo_name:
92 Β»
93 <span class="tag tag8">
83 94 %if h.is_hg(c.rhodecode_db_repo):
84 95 <i class="icon-hg"></i>
85 96 %endif
86 97 %if h.is_git(c.rhodecode_db_repo):
87 98 <i class="icon-git"></i>
88 99 %endif
89 100 %if h.is_svn(c.rhodecode_db_repo):
90 101 <i class="icon-svn"></i>
91 102 %endif
92 103 ${c.repo_name}
93 104 </span>
94 105
95 106 %elif c.repo_group_name:
96 <span class="tag tag-ok disabled">
107 Β»
108 <span class="tag tag8">
97 109 <i class="icon-folder-close"></i>
98 110 ${c.repo_group_name}
99 111 </span>
100 112 %endif
101 113
114
102 115 % for search_tag in c.search_tags:
103 <span class="tag tag-ok disabled">${search_tag}</span>
116 <br/><span class="tag disabled" style="margin-top: 3px">${search_tag}</span>
104 117 % endfor
105 118
106 119 </div>
107 120
108 121 <div class="search-feedback-items">
109 122 % for error in c.errors:
110 123 <span class="error-message">
111 124 % for k,v in error.asdict().items():
112 125 ${k} - ${v}
113 126 % endfor
114 127 </span>
115 128 % endfor
116 129 <div class="field">
117 130 <p class="filterexample" style="position: inherit" onclick="$('#search-help').toggle()">${_('Query Langague examples')}</p>
118 131 <pre id="search-help" style="display: none">\
119 132
120 133 % if c.searcher.name == 'whoosh':
121 134 Example filter terms for `Whoosh` search:
122 135 query lang: <a href="${c.searcher.query_lang_doc}">Whoosh Query Language</a>
123 136 Whoosh has limited query capabilities. For advanced search use ElasticSearch 6 from RhodeCode EE edition.
124 137
125 138 Generate wildcards using '*' character:
126 139 "repo_name:vcs*" - search everything starting with 'vcs'
127 140 "repo_name:*vcs*" - search for repository containing 'vcs'
128 141
129 142 Optional AND / OR operators in queries
130 143 "repo_name:vcs OR repo_name:test"
131 144 "owner:test AND repo_name:test*" AND extension:py
132 145
133 146 Move advanced search is available via ElasticSearch6 backend in EE edition.
134 147 % elif c.searcher.name == 'elasticsearch' and c.searcher.es_version == '2':
135 148 Example filter terms for `ElasticSearch-${c.searcher.es_version}`search:
136 149 ElasticSearch-2 has limited query capabilities. For advanced search use ElasticSearch 6 from RhodeCode EE edition.
137 150
138 151 search type: content (File Content)
139 152 indexed fields: content
140 153
141 154 # search for `fix` string in all files
142 155 fix
143 156
144 157 search type: commit (Commit message)
145 158 indexed fields: message
146 159
147 160 search type: path (File name)
148 161 indexed fields: path
149 162
150 163 % else:
151 164 Example filter terms for `ElasticSearch-${c.searcher.es_version}`search:
152 165 query lang: <a href="${c.searcher.query_lang_doc}">ES 6 Query Language</a>
153 166 The reserved characters needed espace by `\`: + - = && || > < ! ( ) { } [ ] ^ " ~ * ? : \ /
154 167 % for handler in c.searcher.get_handlers().values():
155 168
156 169 search type: ${handler.search_type_label}
157 170 *indexed fields*: ${', '.join( [('\n ' if x[0]%4==0 else '')+x[1] for x in enumerate(handler.es_6_field_names)])}
158 171 % for entry in handler.es_6_example_queries:
159 172 ${entry.rstrip()}
160 173 % endfor
161 174 % endfor
162 175
163 176 % endif
164 177 </pre>
165 178 </div>
166 179
167 180 <div class="field">${c.runtime}</div>
168 181 </div>
169 182 </div>
170 183 </div>
171 184
172 185 ${h.end_form()}
173 186 <div class="search">
174 187 % if c.search_type == 'content':
175 188 <%include file='search_content.mako'/>
176 189 % elif c.search_type == 'path':
177 190 <%include file='search_path.mako'/>
178 191 % elif c.search_type == 'commit':
179 192 <%include file='search_commit.mako'/>
180 193 % elif c.search_type == 'repository':
181 194 <%include file='search_repository.mako'/>
182 195 % endif
183 196 </div>
184 197 </div>
185 198 <script>
186 199 $(document).ready(function(){
187 200 $("#id_search_type").select2({
188 201 'containerCssClass': "drop-menu",
189 202 'dropdownCssClass': "drop-menu-dropdown",
190 203 'dropdownAutoWidth': true,
191 204 'minimumResultsForSearch': -1
192 205 });
193 206
194 207 $('#q').autoGrowInput({maxWidth: 920});
195 208
196 209 setTimeout(function() {
197 210 $('#q').keyup()
198 211 }, 1);
199 212 })
200 213 </script>
201 214 </%def>
General Comments 0
You need to be logged in to leave comments. Login now