2

I have a view that exposes a filter for user input to "search" a list of taxonomy. My problem lies in sorting the results, which are by default alphabetically sorted.

block view screenshot

The filter criteria takes user-inputted data from exposed form and uses the "contains" operator on a taxonomy vocabulary, thus returning (alphabetically) any taxonomy term names that contain the given input text. There is no sort criteria applied, thus defaulting to an alphabetically sorted list of taxonomy terms.

The exposed filter uses "contains" as the operator, but is it possible to show "starts with" operator results before or at the top of the alphabetical list of "contains" operator results.

filter criterion

I have tried using combined fields filter, but seem to only be able to combine fields, and not these operators such as contains, starts with, is equal to, ends with.

How might i implement a way to have my view display results that start with the given exposed filter (user) inputted value, then the results that contain the same given exposed filter input.

Combined fields filter seems to only allow multiple fields, not multiple operators or operators with && || and or type options. global combine fields filter example

Any advice is appreciated. Thanks in advance.

1 Answer 1

2

Well, that's obvious mister - filter criteria has nothing to do with results sorting. On your first screenshot, see "SORT CRITERIA" in the left bottom? you can setup sorting there by adding content field or fields to be sorted by.

2
  • 1
    I think the issue @embo is having is that he wants two sort parameters and for them to be weighted differently. The first sort to show should be anything that starts with and the second should be anything that contains. For instance searching "Za" should show Zambonis first, then Pizza.
    – CR47
    Commented Jun 14, 2013 at 11:49
  • Maybe, but filtering is still not sorting, you know. This probably can be done. It could be done with Sorting groups (you can group sorts when create them), but for sorting like you mention I'd say it require custom sort handler to write.
    – 32i
    Commented Jun 19, 2013 at 6:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.