Created
April 30, 2010 20:00
-
-
Save deanlandolt/385677 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| query: function(query, options) { | |
| options = options || {}; | |
| // FIXME use facets | |
| var defaultRangeLength = config.defaultRangeLength || 25; // TODO get from settings | |
| var slice = function() { | |
| var length, | |
| xquery = ""; | |
| if (defaultRangeLength && !(options.start == 0 && options.end == Infinity)) { | |
| options.start = options.start || 0; | |
| options.end = options.end || Infinity; | |
| if ((options.end - options.start) > defaultRangeLength) { | |
| options.end = options.start + defaultRangeLength - 1 | |
| } | |
| } | |
| if (options.start >= 0 && options.end) length = options.end - options.start + 1; | |
| if (options.start >= 0) { | |
| xquery = "[" + (options.start + 1) + " to "; | |
| xquery += (options.end !== Infinity && (options.end + 1) || "last()") + "]"; | |
| } | |
| // TODO handle empty start | |
| return { | |
| xquery: xquery, | |
| length: length | |
| } | |
| }(); | |
| // ... | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment