ZenphotoCMS Forum
What determines image order of search results? - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: What determines image order of search results? (/thread-10874.html)



What determines image order of search results? - tplowe56 - 2013-02-24

Looking at the forums it appears that the Gallery Sort should determine the sort of search returns.

This is not the behavior I get. My images are sorted by a custom sequential number in the location field within each album, but this does not seem to have any bearing on the sort either.

So when a user clicks on a Tag that returns 500 images the sort seems completely random.

Tried various custom sorts in the gallery settings, with nothing seeming to effect the search returns.

Wouldn't mind being able to set a custom sort like "date,filename" Ascending - for searches while retaining custom sort for albums.


What determines image order of search results? - sbillard - 2013-02-24

You can pass sort orders to the next_xxx functions and get the order you want. Otherwise, a serch will return the items in a "relevance" order--kind of a count of how many of the search criteria match the item.


What determines image order of search results? - tplowe56 - 2013-02-24

Don't understand how your answer corresponds with your previous posts.

http://www.zenphoto.org/support/topic.php?id=9728

Do I need to pass the sort order from my theme? Searching entire form for example of this concept & can't get exactly how to accomplish this.


What determines image order of search results? - tplowe56 - 2013-02-24

It looks like it would need to be passed from this file "search.php" in zpArdoise, correct?
`


<?php printf(ngettext('%1$u Hit for [i]%2$s[/i]', '%1$u Hits for [i]%2$s[/i]', $total), $total, html_encode($searchwords)); ?>


<?php if ($total == 0 ) { ?>

<?php echo gettext("Sorry, no matches found. Try refining your search."); ?>


<?php } ?>





<?php

if (getOption('search_no_albums')) {

if ($numimages > 0) {

echo'<ul class="search-item">[*]'; printf(gettext('Images (%s)'), $numimages); echo'</ul>';

}

} else {

if (getOption('search_no_images')) {

if ($numalbums > 0) {

echo'<ul class="search-item">[*]'; printf(gettext('Albums (%s)'), $numalbums); echo'</ul>';

}

} else {

if ($total1 > 0) {

echo'<ul class="search-item">[*]'; printf(gettext('Albums (%1$s) & Images (%2$s)'), $numalbums, $numimages); echo'</ul>';

}

}

}

?>

<?php if (function_exists('printSlideShowLink')) { ?>

<div class="control-nav">

<div class="control-slide">

<?php printSlideShowLink(gettext('Slideshow')); ?>



</div>

<?php } ?>



<?php printPageListWithNav(' « ', ' » ', false, true, 'clearfix', NULL, true, 7); ?>



<?php

if (getNumAlbums() > 0) {

include('inc_print_album_thumb.php');

}

if (getNumImages() > 0) {

include('inc_print_image_thumb.php');

}

?>
`


What determines image order of search results? - acrylian - 2013-02-24

Again, we are not familiar with third party themes. Look at the official ones' search.php and you find a next_album and next_image loop for results. You have then to find where these are in this theme, that will probably be in the files being included here which no official theme does that way (although not that bad idea to not have the same code on several theme files).


What determines image order of search results? - tplowe56 - 2013-02-24

Thanks!!


What determines image order of search results? - wongm - 2013-06-04

A check of the search.php file in the 'default' theme didn't help me.

But the following call to next_image() will output search results in date order, with the newest items at the top.

`next_image(false, NULL, 'date', 'desc')`

Older versions of Zenphoto used to sort the search results in the above way - my old install of version 1.4.1.6 did just that.


What determines image order of search results? - acrylian - 2013-06-04

Yes. But search of course is listed by relevance, depending on what fields you enabled. Look at the "related items" on our site, that is done by relevance of tags only. If you output the array you will see a specific field "weight" which determinees that (only Zenpage pages currently have none if I recall correctly)