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

Search results are not sorted #182

Open
cmaudoux opened this issue Nov 5, 2024 · 3 comments
Open

Search results are not sorted #182

cmaudoux opened this issue Nov 5, 2024 · 3 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@cmaudoux
Copy link
Contributor

cmaudoux commented Nov 5, 2024

Set params like this:

$attributes_map = array(
   'fullname' => array( 'attribute' => 'cn', 'faclass' => 'user-circle', 'type' => 'text' ),
    'identifier' => array( 'attribute' => 'uid', 'faclass' => 'id-card', 'type' => 'text' ),
    'mail' => array( 'attribute' => 'mail', 'faclass' => 'envelope-o', 'type' => 'mailto' ),
    'lastname' => array( 'attribute' => 'sn', 'faclass' => 'user', 'type' => 'text' ),
    'firstname' => array( 'attribute' => 'givenname', 'faclass' => 'user-o', 'type' => 'text' ),
...................


$search_attributes = array('sn', 'givenname', 'uid');
$search_use_substring_match = true;
$search_result_items = array('identifier', 'lastname', 'mail');
$search_result_title = "fullname";
$search_result_sortby = "lastname";
$search_result_linkto = array("fullname");

Maybe I do not understand and there is a misconfiguration...
Results are not sorted by lastname or last column.

I tried $search_result_sortby = "sn";
and it is the same.
Seems results are always sorted by mail...

@cmaudoux cmaudoux closed this as completed Nov 5, 2024
@cmaudoux cmaudoux reopened this Nov 5, 2024
@cmaudoux cmaudoux changed the title Search results can be sorted by displayed attributes only Search results are not sorted Nov 5, 2024
@coudot coudot added this to the 0.6 milestone Nov 5, 2024
@coudot coudot added the bug Something isn't working label Nov 7, 2024
@coudot coudot self-assigned this Nov 7, 2024
@davidcoutadeur davidcoutadeur self-assigned this Nov 18, 2024
@davidcoutadeur
Copy link

Hello @cmaudoux

It seems ok on my side.

sd-sort-issue

The tricky side here is that you have to define the sorting column in the search_result_times variable, like:

$search_result_items = array('identifier', 'mail', 'mobile', 'lastname' );
$search_result_sortby = "lastname";

but you have already done this.

For information, the good way to declare the sortby option is by using the key and not the attribute value. For example:

$search_result_sortby = 'lastname';

Could you give more info on your issue? Especially, could you give an example of incorrect lastname sorting? When this occurs, do you see the small ordering triangle near the lastname column?

Regards,
David

Note:

  • maybe we could do some optimization here, as the ldap entries are sorted in ltb-common library, and are re-sorted by the javascript library?

@coudot coudot removed their assignment Nov 18, 2024
@cmaudoux
Copy link
Contributor Author

Hi @davidcoutadeur
Thx for your reply.

Pbe is you can sort by displayed attribute only.
By example, I would like to display $search_result_items = array('identifier', 'mail');
and sort by $search_result_sortby = "lastname";

Maybe removing JS sort process could solve this pbe...

@davidcoutadeur
Copy link

Hi @davidcoutadeur Thx for your reply.

Pbe is you can sort by displayed attribute only. By example, I would like to display $search_result_items = array('identifier', 'mail'); and sort by $search_result_sortby = "lastname";

Maybe removing JS sort process could solve this pbe...

Hello Christophe,

Actually, the sort is done at two places: in the php code and in the js. So indeed, if you disable the sorting at javascript side, this should do the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants