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