Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow options.sort to be a sort function #24

Open
franklin-ross opened this issue Jul 22, 2015 · 6 comments
Open

Allow options.sort to be a sort function #24

franklin-ross opened this issue Jul 22, 2015 · 6 comments

Comments

@franklin-ross
Copy link

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 like options.sort = function (results) { return results; }.

@broerse
Copy link

broerse commented Jul 22, 2015

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

@franklin-ross
Copy link
Author

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
#24 (comment)
.

@franklin-ross
Copy link
Author

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
#24 (comment)
.

@broerse
Copy link

broerse commented Jul 22, 2015

@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 😄 It would be great if you can create a PR for the documentation.

@franklin-ross
Copy link
Author

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.

@broerse
Copy link

broerse commented Jul 23, 2015

Super! If you need help with github please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants