OK, let me try this another way. Using XQuery, I can transform the search:response I get from search:search to transform the URNs to the English words I want. If I can insert this code in the appropriate place in the appbuilder XQuery that actually does the search:search, then all of the existing javascript should work as is (i.e., the appropriate "value" will be populated in the TopicReference Object from the "search:response").
Can someone point me to where this would be within the appbuilder built app code? Thanks, David From: general-boun...@developer.marklogic.com [mailto:general-boun...@developer.marklogic.com] On Behalf Of Steiner, David J. (LNG-DAY) Sent: Tuesday, December 16, 2014 10:21 AM To: MarkLogic Developer Discussion Subject: [MarkLogic Dev General] trying to substitute value of facet in app builder app Sorry if the pictures don't come through... The values that I have in an attribute are a facet that I want to display in the sidebar. However, the values are urns and I would like to display the English words instead. I can see in sidebar.js where these lists are being created. Now, I do have more than one facet so I only want to do this for one of the facets, which complicates it a bit, but I'm not quite sure how to go back far enough in the javascript to figure out where I can do the substitution. "valueEscaped" appears to be where I want to display the English words. To go back from there, it would appear that all of this is in "facetData" which seems to come from "data". Though, I'm not particularly adept at javascript. Is there a way to create the "value" in the "data" before it gets this far - like something when the search gets all of the facet data that I can just substitute somehow so that by the time it gets to sidebar.js "value" already has the "correct" (English words) value in it? Or is best to create some sort of big array here and just do the substitution here if the "constraint" is the particular constraint that I want this done for? sidebar.js buildFacet = function (constraint, data) { var html = '', label, facetData, listDisplay, listHidden, listTipdown; ... facetData = data.facets[constraint].facetValues; ... if (facetData !== undefined) { html += '<ul class="'+listHidden+'">'; var i, len; for (i=0,len=facetData.length; i < len; i = i + 1) { // Handle any quotes in facet data nameEscaped = facetData[i].name.toString().replace(/"/g, '"'); valueEscaped = facetData[i].value.toString().replace(/"/g, '"'); // Do not display item if more... unclicked and item number over limit itemDisplay = (($.inArray(constraint, moreItems) === -1) && (i > limit-1)) ? ' hidden' : ''; html += '<li class="facet-item' + itemDisplay + '">' + '<a href="#" rel="'+nameEscaped+'" title="'+nameEscaped+'">' + truncateStr(valueEscaped, 32) + '</a> ' + '<span class="count">(' + facetData[i].count + ')</span>' + '</li>'; } ... [cid:image002.png@01D01888.FDDE2F40] [cid:image001.png@01D01885.ABEB5CB0]
_______________________________________________ General mailing list General@developer.marklogic.com http://developer.marklogic.com/mailman/listinfo/general