Search results looping

zjohn13

Joined: 2010-12-01
Posts: 94
Posted: Fri, 2013-10-04 18:28

Since updating to G3.0.8 I have a problem stepping through photos in search results.
This is different to an issue that I flagged up previously via http://galleryproject.org/node/111953

Entering a search key word accuratley displays a list of matching photo thumbnails.
Clicking on first thumbnail displays the photo page then enables stepping through other photos in the result list by clicking Next.
With most key words I can step Next and Previous through the complete list of results with no problem but with some words I'll get to a point such a 6 of 50 then the next photo shows 0 of 50.
Clicking Next now returns to 1 of 50, stepping on gets to the same point where 0 of 50 loops it back again.

The point at which the problem occurs in the sequence varies with different key words.
A photo that displays 0 of nnn in one search will step through correctly if it happens to appear in a different search list.
Some search result lists displaying hundreds of photos work OK, others do not.

This occurs on a test system with no customisation applied as well as a customised production system.

Has anyone else experience this?

John

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Fri, 2013-10-04 21:42

Too hard to follow and think this out (for me) with just the words. Link to site?

 
zjohn13

Joined: 2010-12-01
Posts: 94
Posted: Sat, 2013-10-05 06:50

Thanks tempg.
Search is being run via a menu page which I have removed while I have this issue.
You can run it via http://www.chilternphoto.org.uk/pages/show/Search
Sample search words that have a problem and search list item that displays it are :-
church 2 of 815
amersham 2 of 171
chesham 5 of 193
aldbury 4 of 64
harrison 2 of 466

John

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Sat, 2013-10-05 14:59

I see.
Something's wrong with the php somewhere.
Yeah, that's not much help, but can't give you more than that--especially since it looks like a customized version of the php that I'm not familiar with.

The only direction I can give is to find what the break points have in common, find the applicable code, and tinker around.

As a starting point, looks like the loop issue comes up the first time an image is in a separate album. So, for "aldbury," for example, the first 3 images are all in the same album so no problem; but, when you get to the 4th item, it's in a different album and there begins your loop. Also noted that it doesn't happen if you just skip the first 3 and start on the 4th; after the first album change, it seems to work okay. Could be weird coincidence, but I'd start by looking at that.

 
zjohn13

Joined: 2010-12-01
Posts: 94
Posted: Sun, 2013-10-06 10:07

Thanks for the pointers tempg.
I've looked through all the Search module code and it's all beyond me so I'll concentrate on testing using ten different problem search words.
1) Some of them do loop at the point where the next photo in the list is in a different album but others do it mid way through an album.
2) Every photo that loops will do so by stepping through the photo pages to it or by clicking on the thumbnail directly.
3) The photos are not the problem because one that loops will step through OK when it appears in a list with a different search word.
4) When logged in and able to view old albums hidden to users via permissions, a search will display additional results and the loop photo in the list will be a different one.

I have been using the production gallery for these tests because of the amount of data that it contains but let's bypass the spectre at the feast, customisation.

I've installed a trial g3.0.8 with no configuration or customisation, this “out of the box” gallery contains two albums, one holding ten photos and the other holding five.
The albums and photos all contain the word amersham.
Search word amersham displays all 17 items, it loops on the ninth item (photo of postman's bike).
http://www.chilternphoto.org.uk/g3trial/index.php/search?album=1&q=amersham

It's not much to work with but maybe less is more.....

PS. Don't click on the first thumbnail, it's an album and we know that this can add confusion :-)

 
zjohn13

Joined: 2010-12-01
Posts: 94
Posted: Mon, 2013-10-07 09:51

Versions of server software in case there is an interaction issue.

Apache version 2.4.6
PHP version 5.3.27
MySQL version 5.5.32-cll
Architecture x86_64
Operating system linux
Perl version 5.8.8
Kernel version 2.6.18-448.16.1.el5.lve0.8.7

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Wed, 2013-10-09 16:41

1. Not necessarily relevant here, but the latest Gallery version is 3.0.9; if you're going to test, might as well test against the latest version.

2. I don't have a "spare" gallery to test with at the moment. The issue doesn't affect my Gallery installs, so I'll have to later create space and install a new instance to try to reproduce. (Without reproducing it, I can't really sift through the php to find the issue.)

3. When you say that you installed fresh, I'm assuming that means no extra modules, no theme customizations, and no permissions; correct?

EDIT: Forgot that I'd just installed a clean version of Gallery for someone to use for their family photos. Again, can't reproduce the issue. Try moving to Gallery 3.0.9 and see if the issue still exists. Really can't offer more than that unless someone else has the issue or new information helps me to reproduce the error.

Anyone else able to reproduce the issue with a "vanilla" instance of Gallery 3.0.9?

 
zjohn13

Joined: 2010-12-01
Posts: 94
Posted: Wed, 2013-10-09 17:08

1. It took me forever to re-apply customisation after updating to 3.0.8 (the customisation is all about appearance, mainly removing items from page displays) and I'm rather apprehensive about doing it all again just yet.

2. Completely understand that if you can not reproduce the issue you can not fix anything.

3. Yes, new installation, no extra modules, no permissions, nothing touched at all, just albums and photos added.

If nobody else has experienced this with 3.0.8/9 I'll just have to look harder at my system.
Many thanks for your time spent investigating this.
John

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Wed, 2013-10-09 17:37

Just my two cents, I'm unable to reproduce either on 3.0.7 - 3.0.9 tests.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2013-10-10 03:20
Quote:
1. It took me forever to re-apply customisation after updating to 3.0.8 (the customisation is all about appearance, mainly removing items from page displays) and I'm rather apprehensive about doing it all again just yet.

Why not just create your own theme with the customizations. Then you don't have to reapply them.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
zjohn13

Joined: 2010-12-01
Posts: 94
Posted: Fri, 2013-10-11 21:26

Thanks Dave, I'll do that once I have sorted out this issue, it should minimise the work but even themes and modules are prone to change and should be updated :-)

Removed customised Search module and reinstalled original version supplied with v3.0.8 but no difference, I'll work back through other customised areas.

 
zjohn13

Joined: 2010-12-01
Posts: 94
Posted: Sun, 2013-10-13 10:56

To create a customised theme do I just need to put the theme files in a folder named "clean_canvas_custom" to differentiate it from the unmodified "clean_canvas", then edit the theme.info file to change the name to "name = "Clean Canvas Theme custom" and then select it in Admin/Appearance/Theme choice?
And can I make the similar changes to customise modules?

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2013-10-13 11:46
 
zjohn13

Joined: 2010-12-01
Posts: 94
Posted: Sun, 2013-10-13 16:35

Thanks Dave, I'll get on with this to separate out my customisation.

 
zjohn13

Joined: 2010-12-01
Posts: 94
Posted: Mon, 2013-10-14 21:46

Is there any documentation available on how the search result order is established?
Looking at the code in search/helpers/search.php there is a line " ORDER BY `score` DESC");
It looks as though the photo description is the secondary order but I'm not sure what 'score' refers to.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2013-10-14 22:07

SQL is complex and over my head but...
The “score” is calculated by hard code formula within mySQL itself.
Full details on this formula can be found here : http://dev.mysql.com/doc/internals/en/full-text-search.html

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Tue, 2013-10-15 15:00

In addition to the link @floridave provided, know that Gallery is specifically looking at the image title, image description, and keyword tags. As far as I am aware, each of those is considered equal. A simplified view is that Gallery looks at all of those fields and gives 1 point for each occurrence of whatever it is that you're searching for. (Again, this is an overly simplified understanding.) The info at the link is more precise and will also help you understand how partial and approximate matches are scored as well.

I'm not sure what you're looking at, so I'm not sure how "It looks as though the photo description is the secondary order." If you got that from "DESC," know that DESC is an abbreviation for "Descending"; the opposite being "ASC" for "ascending" order. DESC makes sure that the highest score is first and the results put the lowest scores at the bottom.

 
zjohn13

Joined: 2010-12-01
Posts: 94
Posted: Tue, 2013-10-15 16:23

Thanks for the link Dave, it confirms that with my limited experience I'll not be able to make any further headway with that line of investigation.
I have however created a customised Clean Canvas theme and search module.
Thanks also tempg for your simplified explanation of search loading and the "DESC" function which I had misunderstood.
I'm going away for a few days so will put this on hold until I return, hopefully with divine inspiration to tackle it again.

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Sat, 2013-12-28 22:15

@zjohn13: It's always difficult to assist without complete information.

I just saw your post at http://galleryproject.org/node/112412#comment-407564 (which led me to http://galleryproject.org/node/108285#comment-407543 and the attached file there). That's a lot of looking around. For future reference, it would have helped if you'd specified (in THIS thread) the customizations you'd done to the search module.

(1) Make a full backup.
(2) Establish a subdomain (or just use an entirely different domain name) for testing.
(3) Install a new, freshly downloaded copy of the latest Gallery (currently 3.0.9).
(4) Make 2-3 albums and put 5-6 images in each.
(5) Add tags to them (use standard words only, without punctuation or anything "special").
(6) Verify that it works the way it should (without loops).

If everything is still working at that point, add in your customizations, but NOT the way you did it before. DO NOT modify the original files. All of the changes should be made in your theme's subfolder. So, for example, instead of changing the search/helpers/search.php file, make a copy of the file (that you'll use to make your changes) and put THAT file in your theme > helpers folder. Do the same thing for the search views and all other files that you've modified. [i]Still keep a listing of the changes that you're making, and note that this will NOT avoid you having to get dirty with the code if Gallery makes major changes--as may happen with 3.1--but it does help you move seamlessly between, for example, 3.0.5 to 3.0.7 to 3.0.9)

After you've done that, see if it works properly. If it's not working at that point, you'll have a narrower view of where the issue is and you can delete the custom files one by one to see when it starts working properly again. If it IS working, the original issue is likely with your images (and/or the image metadata--including, maybe, an issue with the way Gallery is reading your tags or something.) The key is to make the changes one by one so you can identify which change breaks your gallery (and make sure that you've cleared all caches before checking to see what's working). This may also help you to resolve your other issue at http://galleryproject.org/node/108285#comment-407543

If you can't figure it out this way, I don't know what else to tell you. I can't really do this for you because time is extremely short and I'm a bit behind.

Report back.

 
zjohn13

Joined: 2010-12-01
Posts: 94
Posted: Wed, 2014-01-01 11:05

Sorry for the confusion caused by cross linking threads that I thought may be related, I'll now stay with this one.

Have created a sub domain and installed G3.0.9 in it.
Created one album and uploaded six photos into it.
The album in named "Amersham" (a town name) and all the photos have the word Amersham in their Description.
No Tags have been created.
Searching with word "amersham" lists seven item, the first being the album followed by the photos.
Don't click on the album but click the following photo in the list. (Issues caused by opening an album while in a search list is discussed in another thread).
Then step through the photos via Next until you get to one that displays 0 of 7.
Click on next again goes to 1 of 7 which is the album.
http://www.g3trial.chilternphoto.org.uk/index.php/

However, if in the Amersham album I rename the Title, Description and Directory name (the Internet address can be left as Amersham) to remove the word Amersham, Search displays the photos without looping.

This issue only occurred after updating my live system from 3.0.2 to 3.0.8.
At this point the Search list changed from the old mode where you had to hit the browser back button after viewing a photo to return to the Search list to the much improved mode where you can step through photos in list order by pressing Next.
I do feel that Album and Photo items being in the Search list is somehow involved in the issue.