1var SwiftypeCommon = SwiftypeCommon || {}; 2 3//search box autocomplete items limit 4SwiftypeCommon.AutocompleteLimit = 6; 5//search results per page 6SwiftypeCommon.ResultsPerPage = 12; 7 8//filters for search box autocomplete and search results 9SwiftypeCommon.Filters = { 10 Pages: { 11 'page': { 12 'content_type': ['!product_category', '!product_subcategory', '!product'], 13 'is_page': 'true' 14 } 15 }, 16 ProductCategories: { 17 'page': { 18 'content_type': ['product_category', 'product_subcategory'], 19 'is_page': 'true' 20 } 21 }, 22 Products: { 23 'page': { 24 'content_type': ['product'], 25 'is_page': 'true' 26 } 27 }, 28 Resources: { 29 'page': { 30 'is_page': '!true' 31 } 32 } 33}; 34 35//copied htmlEscape from jquery.swiftype.search.js 36SwiftypeCommon.HtmlEscape = function (str) { 37 return String(str).replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, ''').replace(/</g, '<').replace(/>/g, '>'); 38}; 39 40SwiftypeCommon.GetFileExtension = function (url) { 41 const path = new URL(url).pathname; // Get the path from the URL 42 const segments = path.split('/'); // Split the path into segments 43 const filename = segments[segments.length - 1]; // Get the filename from the last segment 44 const parts = filename.split('.'); // Split filename to get the parts 45 if (parts.length > 1) { 46 const extension = parts.pop(); // Get the last part (which is the extension) 47 return extension; 48 } 49 return ''; 50};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.