Changeset 566 for trunk/grails-app
- Timestamp:
- Jun 3, 2010, 4:31:44 AM (15 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/InventoryItemDetailedController.groovy
r562 r566 148 148 params.searchComment = session.inventoryItemSearchComment 149 149 params.searchLocation = session.inventoryItemSearchLocation 150 params.searchGroup = session.inventoryItemSearchGroup 150 151 params.searchSpareFor = session.inventoryItemSearchSpareFor 151 152 } … … 186 187 session.removeAttribute("inventoryItemSearchComment") 187 188 session.removeAttribute("inventoryItemSearchLocation") 189 session.removeAttribute("inventoryItemSearchGroup") 188 190 session.removeAttribute("inventoryItemSearchSpareFor") 189 191 session.removeAttribute("inventoryItemQuickSearch") … … 203 205 session.inventoryItemSearchComment = params.searchComment 204 206 session.inventoryItemSearchLocation = params.searchLocation 207 session.inventoryItemSearchGroup = params.searchGroup 205 208 session.inventoryItemSearchSpareFor = params.searchSpareFor 206 209 // Clear any previous search. … … 228 231 session.removeAttribute("inventoryItemSearchComment") 229 232 session.removeAttribute("inventoryItemSearchLocation") 233 session.removeAttribute("inventoryItemSearchGroup") 230 234 session.removeAttribute("inventoryItemSearchSpareFor") 231 235 session.removeAttribute("inventoryItemSearchFilterParams") -
trunk/grails-app/domain/InventoryGroup.groovy
r116 r566 12 12 13 13 String toString() {"${this.name}"} 14 15 static searchable = { 16 root false // only index as a component of InventoryItem. 17 only = ['name'] 18 } 19 14 20 } -
trunk/grails-app/domain/InventoryItem.groovy
r562 r566 62 62 63 63 static searchable = { 64 only = ['name', 'description', 'comment', 'i nventoryLocation', 'spareFor']64 only = ['name', 'description', 'comment', 'isActive', 'isObsolete', 'inventoryLocation', 'inventoryGroup', 'spareFor'] 65 65 //name boost: 1.5 66 66 inventoryLocation component: true 67 inventoryGroup component: true 67 68 spareFor component: true 68 69 } -
trunk/grails-app/services/InventoryItemSearchService.groovy
r562 r566 159 159 // Build searchableParams. 160 160 // Do not include params.sort, since not all properites are indexed. 161 def searchableParams = [max: params.max, offset: params.offset, 162 reload: true, defaultOperator: 'or'] 161 def searchableParams = [:] 162 searchableParams.max = params.max 163 searchableParams.offset = params.offset 164 searchableParams.reload = true 165 searchableParams.defaultOperator = 'or' 166 def properitesList = [] 167 if(params.searchName) 168 properitesList << '$/InventoryItem/name' 169 if(params.searchDescription) 170 properitesList << '$/InventoryItem/description' 171 if(params.searchComment) 172 properitesList << '$/InventoryItem/comment' 173 if(params.searchLocation) 174 properitesList << '$/InventoryItem/inventoryLocation/name' 175 if(params.searchGroup) 176 properitesList << '$/InventoryItem/inventoryGroup/name' 177 if(params.searchSpareFor) { 178 properitesList << '$/InventoryItem/spareFor/name' 179 properitesList << '$/InventoryItem/spareFor/description' 180 properitesList << '$/InventoryItem/spareFor/comment' 181 } 182 if(properitesList) 183 searchableParams.properties = properitesList 184 185 // Require isActive and isObsolete. 186 def queryString = '( '+result.searchText+' )'+ ' AND isActive:"true" AND isObsolete:"false"' 163 187 164 188 // Perform the searchable query. 165 189 try { 166 result.inventoryItemList = InventoryItem.search(result.searchText, searchableParams) 190 result.inventoryItemList = InventoryItem.search(queryString, searchableParams) 191 192 // Would be nice if this worked. 193 // result.inventoryItemList = InventoryItem.search(result.searchText, searchableParams) { 194 // must(term("isActive", true)) 195 // must(term("isObsolete", false)) 196 // } 197 167 198 } catch (e) { 168 199 log.error e -
trunk/grails-app/views/inventoryItemDetailed/search.gsp
r565 r566 271 271 <tr class="prop"> 272 272 <td valign="top" class="name"> 273 274 <jsUtil:toggleControl toggleId="limitSearch" 275 imageId="limitSearchImg" 276 closedImgUrl="${resource(dir:'images/skin',file:'bullet_toggle_plus.png')}" 277 openImgUrl="${resource(dir:'images/skin',file:'bullet_toggle_minus.png')}" 278 effect="fade" 279 text="Limit Search" 280 /> 273 281 </td> 274 282 <td valign="top" class="value"> 275 <!-- <g:checkBox name="searchName" value="${true}" ></g:checkBox> --> 276 <label for="searchName">Name,</label> 277 <!-- <g:checkBox name="searchDescription" value="${true}" ></g:checkBox> --> 278 <label for="searchDescription">Description,</label> 279 <!-- <g:checkBox name="searchComment" value="${true}" ></g:checkBox> --> 280 <label for="searchComment">Comment,</label> 281 <!-- <g:checkBox name="searchLocation" value="${true}" ></g:checkBox> --> 282 <label for="searchLocation">Location and</label> 283 <!-- <g:checkBox name="searchSpareFor" value="${true}" ></g:checkBox> --> 284 <label for="searchSpareFor">Spare For (Asset: name, description and comment).</label> 283 <g:if test="${params.searchName || params.searchDescription || params.searchComment || params.searchLocation || params.searchGroup || params.searchSpareFor}" > 284 <div id="limitSearch"> 285 </g:if> 286 <g:else> 287 <div id="limitSearch" style="display:none;"> 288 </g:else> 289 <g:checkBox name="searchName" value="${params.searchName}" ></g:checkBox> 290 <label for="searchName">Name</label> 291 <g:checkBox name="searchDescription" value="${params.searchDescription}" ></g:checkBox> 292 <label for="searchDescription">Description</label> 293 <g:checkBox name="searchComment" value="${params.searchComment}" ></g:checkBox> 294 <label for="searchComment">Comment</label> 295 <g:checkBox name="searchLocation" value="${params.searchLocation}" ></g:checkBox> 296 <label for="searchLocation">Location</label> 297 <g:checkBox name="searchGroup" value="${params.searchGroup}" ></g:checkBox> 298 <label for="searchGroup">Group</label> 299 <br /> 300 <g:checkBox name="searchSpareFor" value="${params.searchSpareFor}" ></g:checkBox> 301 <label for="searchSpareFor">Spare For (Asset: Name, Description and Comment).</label> 302 </div> 285 303 </td> 286 304 </tr>
Note: See TracChangeset
for help on using the changeset viewer.