Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Search issues. AND OR (and I miss NOT), also miss "-".  (Read 6076 times)

0 Members and 1 Guest are viewing this topic.

andrez1

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 27
    • Hedmarksmuseets fotoarkiv - Museum archive
Search issues. AND OR (and I miss NOT), also miss "-".
« on: December 08, 2007, 09:57:16 pm »

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

Code: [Select]
$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?

Code: [Select]
$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

 


 
« Last Edit: December 10, 2007, 08:10:57 pm by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Search issues. AND OR (and I miss NOT), also miss "-".
« Reply #1 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"
Logged

andrez1

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 27
    • Hedmarksmuseets fotoarkiv - Museum archive
Re: Search issues. AND OR (and I miss NOT), also miss "-".
« Reply #2 on: December 09, 2007, 04:10:02 pm »

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 :


Code: [Select]
<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
Logged

andrez1

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 27
    • Hedmarksmuseets fotoarkiv - Museum archive
Re: Search issues. AND OR (and I miss NOT), also miss "-".
« Reply #3 on: December 09, 2007, 11:15:00 pm »

Code: [Select]
$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


Code: [Select]
$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:

Code: [Select]
$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

Logged

andrez1

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 27
    • Hedmarksmuseets fotoarkiv - Museum archive
Re: Search issues. AND OR (and I miss NOT), also miss "-".
« Reply #4 on: December 09, 2007, 11:28:32 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
Logged

Nibbler

  • Guest
Re: Search issues. AND OR (and I miss NOT), also miss "-".
« Reply #5 on: December 10, 2007, 08:35:19 am »

If you want AND to be default then make it default

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

andrez1

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 27
    • Hedmarksmuseets fotoarkiv - Museum archive
Re: Search issues. AND OR (and I miss NOT), also miss "-".
« Reply #6 on: December 10, 2007, 04:11:52 pm »

If you want AND to be default then make it default

Code: [Select]
$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
Logged
Pages: [1]   Go Up
 

Page created in 0.024 seconds with 19 queries.