Open franklin-ross opened 9 years ago
We use this:
sifter = new Sifter(input);
if (!sort) {
sifter.getSortFunction = function() {
return null;
};
}
result = sifter.search(query, options);
Yeah I did see that solution in one of the other issues. I just think it'd be easy and clear to add this kind of thing to the API as a documented and supported thing. People obviously want to be able to do it, and I don't think what you put above is very obvious for a casual user of the library, even if it's fairly easy to do.
On Wed, 22 Jul 2015 8:17 pm Martin Broerse notifications@github.com wrote:
We use this:
sifter = new Sifter(input); if (!sort) { sifter.getSortFunction = function() { return null; }; } result = sifter.search(query, options);
in ember-cli-filter-by-query https://github.com/lazybensch/ember-cli-filter-by-query/blob/master/addon/util/filter.js
— Reply to this email directly or view it on GitHub https://github.com/brianreavis/sifter.js/issues/24#issuecomment-123652209 .
Hmm. Well, maybe it is reasonably obvious and I'm just being pedantic 😜
On Wed, 22 Jul 2015 10:10 pm Franklin Ross fhross@gmail.com wrote:
Yeah I did see that solution in one of the other issues. I just think it'd be easy and clear to add this kind of thing to the API as a documented and supported thing. People obviously want to be able to do it, and I don't think what you put above is very obvious for a casual user of the library, even if it's fairly easy to do.
On Wed, 22 Jul 2015 8:17 pm Martin Broerse notifications@github.com wrote:
We use this:
sifter = new Sifter(input); if (!sort) { sifter.getSortFunction = function() { return null; }; } result = sifter.search(query, options);
in ember-cli-filter-by-query https://github.com/lazybensch/ember-cli-filter-by-query/blob/master/addon/util/filter.js
— Reply to this email directly or view it on GitHub https://github.com/brianreavis/sifter.js/issues/24#issuecomment-123652209 .
@alpha-cast Many people searched for it and didn't find it so I don't think it is to obvious. So perhaps you are not pedantic :smile: It would be great if you can create a PR for the documentation.
Yeah OK. I've never actually created a pull request for GitHub before, but have been meaning to learn for a while. Better late than never ;-P
Give me a few days, I've got a sprint review for a client tomorrow and want to get a couple of things done.
Super! If you need help with github please let me know.
This would make it consistent with the undocumented
options.score
, and would provide much simpler workarounds for some of the other issues which want to disable sorting. In that case you could just do something likeoptions.sort = function (results) { return results; }
.