Search issues. AND OR (and I miss NOT), also miss "-". Search issues. AND OR (and I miss NOT), also miss "-".
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Search issues. AND OR (and I miss NOT), also miss "-".

Started by andrez1, December 08, 2007, 09:57:16 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

andrez1

Uppgrading from a 1.3.5(-7..) to 1.4.14  I have lost some functionality.

I'm aware of the http://forum.coppermine-gallery.net/index.php?topic=47499.0

It does not solve the problem.

I used ready-made searches as http://domkirkeodden.org/fotosamling/thumbnails.php?album=search&type=full&search=hest+kjerre

(In old page,   : http://domkirkeodden.org/fotosamling/cms.php?id=5 , new page http://domkirkeodden.org/fotosamling/index.php?file=minicms/cms&id=5 is under construction.)

People ar also linking to the site whith such URL's. I consider it fair use.


In 1.3.5 it gave a result of  "hest AND kjerre"
in 1.4.14 it gives a result of "hest OR kjerre"


i Guess the line

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


in search.inc.php  is what to change.  How to change it? Can it be done?


Further, i used links like http://domkirkeodden.org/fotosamling/thumbnails.php?album=search&type=full&search=hest+0401+not+0401-
or http://domkirkeodden.org/fotosamling/thumbnails.php?album=search&type=full&search=hest+not+0401-+or+kjerre+not+0415-


In the links above "0401-" have to be intepreted literally, as i have a lot of images named 0401-00001.jpg to around 0401-10000.jpg.
likewise, "0415-".

If "-" gets trunkated  i loose a lot of funtionality.

in search.inc.php below,  what to change?   Can it be done?

$search_string = preg_replace('/&.*;/i', '', $search_string);

$search_string = preg_replace('/[^0-9a-z %@\.\-_]/i', '', $search_string);

if (!$mb_charset)
        $search_string = preg_replace('/[^0-9a-z %]/i', '', $search_string);





Search like "hest+not+0401-+or+kjerre+not+0415-"  could be intepreted  "(hest NOT 0401-)  OR (kjerre NOT 0415-)"


Cant be done anymore, can it?


Mvh Vidar





Joachim Müller

Try adding the boolean operator to the URL, like this http://yourdomain.tld/your_gallery/thumbnails.php?search=foo+bar&album=search&type=OR
Allowed boolean operators are "AND" and "OR"

andrez1

Quote from: GauGau on December 09, 2007, 10:49:26 AM
Try adding the boolean operator to the URL, like this http://yourdomain.tld/your_gallery/thumbnails.php?search=foo+bar&album=search&type=OR
Allowed boolean operators are "AND" and "OR"


Not working.



http://domkirkeodden.org/fotosamling/thumbnails.php?search=hest+kjerre&album=search&type=AND

=OR



http://domkirkeodden.org/fotosamling/thumbnails.php?album=search&type=AND&search=hest+kjerre


=OR


A variant of http://forum.coppermine-gallery.net/index.php?topic=45768.msg217744#msg217744 is :


<form name="custom_search" action="http://domkirkeodden.org/fotosamling/thumbnails.php" method="post">
<input type="text" class="textinput" value="hest kjerre" maxlength="255" name="search" />
<input type="submit" class="button" value="Search" />
<input type="hidden" value="search" name="album" />
<input type="hidden" value="1" name="title" />
<input type="hidden" value="1" name="caption" />
<input type="hidden" value="0" name="keywords" />
<input type="hidden" value="0" name="owner_name" />
<input type="hidden" value="0" name="filename" />
<input type="hidden" value="AND" name="type" />
</form>



It gives proper AND result.


I can use that in minicms pages.

But not in album descriptions. 

Or as a link to give away in a e-mail as a preset search. (I could do that, but not the day-to-day user of the site. I know my Pappenheim'ers)

Coppermine does not show search string in browser adress field any more. Miss that.



Mvh Vidar

andrez1

Quote from: andrez1 on December 08, 2007, 09:57:16 PM
$search_string = preg_replace('/&.*;/i', '', $search_string);

$search_string = preg_replace('/[^0-9a-z %@\.\-_]/i', '', $search_string);

if (!$mb_charset)
        $search_string = preg_replace('/[^0-9a-z %]/i', '', $search_string);



Thats wrong. My fault. code was


$search_string = preg_replace('/&.*;/i', '', $search_string);

if (!$mb_charset)
        $search_string = preg_replace('/[^0-9a-z %]/i', '', $search_string);


The "-" is a non issue. But I did this change:

$search_string = preg_replace('/&.*;/i', '', $search_string);

//if (!$mb_charset)
//        $search_string = preg_replace('/[^0-9a-z %]/i', '', $search_string);


It gives search ability on characters as ÆØÅ æøå  (ànd sö ôn).   Without the change a search on "båt" was trunkated to a search on "bt"

I belive this board (Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC) have the same issue, a search for "a" is ok, a search for "â" give nothing.


If i could get coppermine to set "AND" as the default search type, I'm OK.



Mvh Vidar


andrez1

Quote from: andrez1 on December 09, 2007, 11:15:00 PM
I belive this board (Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC) have the same issue, a search for "a" is ok, a search for "â" give nothing.


"â" is ok, "ä" is not, the word "båt" not found...  SMF that is.


Mvh Vidar

Nibbler

If you want AND to be default then make it default

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

andrez1

Quote from: Nibbler on December 10, 2007, 08:35:19 AM
If you want AND to be default then make it default

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


Very nice. Thanks.

(http://domkirkeodden.org/fotosamling/thumbnails.php?album=search&type=full&search=hest+kjerre now displays 267 pictures with horse AND wagon)

Mvh Vidar