forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: wakedave on January 23, 2008, 09:32:04 am

Title: Custom Search Link
Post by: wakedave on January 23, 2008, 09:32:04 am
I'm looking for a solution to a problem I'm having... For example, I want to search for "big apple" and I use:

thumbnails.php?album=search&search=big+apple

But it returns me all the images that either has "big" OR "apple". Is there a way I can change the link that will search ONLY images that has "big" AND "apple" ?

Also is there a way to change the link that will search within a specific album no.?

I know I can do all this from the Search page, but I would like to be able to have one link address, so I can email to someone and they can go directly to the search results page based on the search keywords I have specified.

Thanks in advance.

PS. I posted this question on what i thought was a similar thread, but I've been told not to hijack it, so I'm starting a new thread. So sorry if this is a repeat.
Title: Re: Custom Search Link
Post by: Pacjack on May 23, 2008, 11:39:19 am
I'm also interested in building a link to search for keyword AND keyword. Anyone?
Title: Re: Custom Search Link
Post by: Zwerg-im-Bikini on June 03, 2009, 08:22:37 am
I'm stuck with the same problem, I need to create search links with more than one word and don't know how. I tried to add "&type=AND" to the link, but it still doesn't work.

Help would be very appreciated :)
Title: Re: Custom Search Link
Post by: Nibbler on June 03, 2009, 05:07:11 pm
If you want &type=AND to work you need to change include/search.inc.php

Code: [Select]
$type = $_POST['type'] == 'AND' ? " AND " : " OR ";

to

Code: [Select]
$type = $_REQUEST['type'] == 'AND' ? " AND " : " OR ";
Title: Re: Custom Search Link
Post by: Zwerg-im-Bikini on June 03, 2009, 09:03:59 pm
It works, thanks a lot!
Title: Re: Custom Search Link
Post by: Zwerg-im-Bikini on June 04, 2009, 11:17:18 am
Sorry, too fast..

Now I noticed that the search results for those links show the correct thumbnails, but when I click on them they link to the wrong pictures. I checked my thumbnails, but they work fine in the album view, so the problem must be the change in the search file.
When I use the coppermine search with single words it works fine, but it doesn't work anymore with more than one word :(. Is there something else I have to change in this file?
Title: Re: Custom Search Link
Post by: Joachim Müller on June 04, 2009, 11:36:45 am
http://forum.coppermine-gallery.net/index.php/topic,55415.msg270616.html#msg270616
Title: Re: Custom Search Link
Post by: Zwerg-im-Bikini on June 04, 2009, 07:27:54 pm
This is the link to the gallery (not official yet... I'm still working on it and hope noone will see it here because it sould be a surprise ;) ):

http://www.planearium.de/galerie/

I need the search-links for certain episodes. Every picture will have the title of the episode where it's from.
For example when I search for "103 - Volcano" the correct thumbnails are shown, but they link to the worng pictures.
Title: Re: Custom Search Link
Post by: Joachim Müller on June 04, 2009, 07:37:53 pm
I suggest upgrading before doing anything else.
Title: Re: Custom Search Link
Post by: sharpo on June 06, 2009, 01:06:26 am
If you want &type=AND to work you need to change include/search.inc.php

Code: [Select]
$type = $_POST['type'] == 'AND' ? " AND " : " OR ";

to

Code: [Select]
$type = $_REQUEST['type'] == 'AND' ? " AND " : " OR ";

I've made the above alteration in my test gallery, what I was hoping it would do is only show images that included "both" search strings. Try this:-

http://www.sharpos-world.co.uk/testing/cpg1424test/thumbnails.php?album=search&search=t99%20t2

Only 1 image includes t99 and t2, which is the result I wanted, but it also shows another image which has just t99.

Is there a solution to this, please.
Title: Re: Custom Search Link
Post by: Nibbler on June 08, 2009, 11:31:50 am
http://www.sharpos-world.co.uk/testing/cpg1424test/thumbnails.php?album=search&search=t99%20t2&type=AND
Title: Re: Custom Search Link
Post by: sharpo on June 08, 2009, 08:23:27 pm
http://www.sharpos-world.co.uk/testing/cpg1424test/thumbnails.php?album=search&search=t99%20t2&type=AND
Thanks very much for that, Nibbler.