@@ -84,11 +84,12 @@ function attach_elastic_search_query_sphinx(data) {
84
84
list_item . append ( extra ) ;
85
85
}
86
86
87
- for ( var j = 0 ; j < blocks . length ; j += 1 ) {
87
+ for ( var block_index = 0 ; block_index < blocks . length ; block_index += 1 ) {
88
+ var current_block = blocks [ block_index ] ;
88
89
89
90
var contents = $ ( '<div class="context">' ) ;
90
91
91
- var section_template = '' +
92
+ var section_template =
92
93
'<div>' +
93
94
'<a href="<%= section_subtitle_link %>">' +
94
95
'<%= section_subtitle %>' +
@@ -100,7 +101,7 @@ function attach_elastic_search_query_sphinx(data) {
100
101
'</div>' +
101
102
'<% } %>' ;
102
103
103
- var domain_template = '' +
104
+ var domain_template =
104
105
'<div>' +
105
106
'<a href="<%= domain_subtitle_link %>">' +
106
107
'<%= domain_subtitle %>' +
@@ -111,8 +112,8 @@ function attach_elastic_search_query_sphinx(data) {
111
112
'</div>' ;
112
113
113
114
// if the result is page section
114
- if ( blocks [ j ] . type === "section" ) {
115
- var section = blocks [ j ] ;
115
+ if ( current_block . type === "section" ) {
116
+ var section = current_block ;
116
117
var section_subtitle = section . title ;
117
118
var section_subtitle_link = link + "#" + section . id ;
118
119
var section_content = [ section . content . substr ( 0 , MAX_SUBSTRING_LIMIT ) + " ..." ] ;
@@ -145,8 +146,8 @@ function attach_elastic_search_query_sphinx(data) {
145
146
}
146
147
147
148
// if the result is a sphinx domain object
148
- if ( blocks [ j ] . type === "domain" ) {
149
- var domain = blocks [ j ] ;
149
+ if ( current_block . type === "domain" ) {
150
+ var domain = current_block ;
150
151
var domain_role_name = domain . role ;
151
152
var domain_subtitle_link = link + "#" + domain . id ;
152
153
var domain_name = domain . name ;
@@ -182,7 +183,7 @@ function attach_elastic_search_query_sphinx(data) {
182
183
183
184
// Create some spacing between the results.
184
185
// Also, don't add this spacing in the last hit.
185
- if ( j < blocks . length - 1 ) {
186
+ if ( block_index < blocks . length - 1 ) {
186
187
list_item . append ( $ ( "<div class='rtd_search_hits_spacing'></div>" ) ) ;
187
188
}
188
189
}
0 commit comments