[Solved]: Search Syntax Question [Solved]: Search Syntax Question
 

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

[Solved]: Search Syntax Question

Started by MarianneC, September 15, 2008, 11:16:26 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MarianneC

I did a search, and I'm not coming up with a match already existing for this question.

The search box on my site works perfectly.  I have it set to default to use the "AND" syntax. So far so good.

However, I also have a set of searches already set up.  They are for street addresses.  And some of the addresses are similar (i.e. they all have "46" in them.)  The results that come back are not clean.

Here is the page:

http://www.useaboston.com/artists_buildings.htm

Here is the things that I have tried:



  <a class="text" href="2008a/thumbnails.php?album=search&type=and&search=46 Plympton">46 Plympton Street (18)</a><br>

or

  <a class="text" href="2008a/thumbnails.php?album=search&type=full&search=46 Plympton">46 Plympton Street (18)</a><br>

or

<a class="text" href="2008a/thumbnails.php?album=search&type=full&search=46+Plympton">46 Plympton Street (18)</a><br>




None of those gets only the correct results.  They all get 46 Waltham as well as 546 Tremont in addition to  46 Plympton.

The last version (with 46+Plympton) apparently worked back in version 1.2 - because that's what I find in an older version of this website.

Any suggestions for how I set up this query in a URL so that it will come back with the proper results?

Many thanks!
Marianne

Nibbler

Can you enable debug mode in config and post the debug output you get at the search results page please?

MarianneC

Thanks, Nibbler.  This is what I got:

USER:
------------------
Array
(
    [ID] => 60cb2243ae4b39fa197a377f2a7c1a33
    [am] => 1
    [lang] => english
    [sort] => na
    [search] => Array
        (
            [search] => 46 Plympton
            [params] => Array
                (
                    [user4] => 1
                    [keywords] => 1
                    [caption] => 1
                    [title] => 1
                )

        )

)

==========================
USER DATA:
------------------
Array
(
    [user_id] => 1
    [user_name] => cfarris
    [groups] => Array
        (
           
  • => 1
            )

        [disk_max] => 0
        [disk_min] => 0
        [can_rate_pictures] => 1
        [can_send_ecards] => 1
        [ufc_max] => 3
        [ufc_min] => 3
        [custom_user_upload] => 0
        [num_file_upload] => 5
        [num_URI_upload] => 3
        [can_post_comments] => 1
        [can_upload_pictures] => 1
        [can_create_albums] => 1
        [has_admin_access] => 1
        [pub_upl_need_approval] => 0
        [priv_upl_need_approval] => 0
        [group_name] => Administrators
        [upload_form_config] => 3
        [group_quota] => 0
        [can_see_all_albums] => 1
        [group_id] => 1
    )

    ==========================
    Queries:
    ------------------
    Array
    (
       
  • => SELECT extension, mime, content, player FROM cpg_filetypes; (0s)
        [1] => select * from cpg_plugins order by priority asc; (0s)
        [2] => delete from `cfarris_copp2`.cpg_sessions where time<1221589397 and remember=0; (0s)
        [3] => delete from `cfarris_copp2`.cpg_sessions where time<1220383397; (0s)
        [4] => select user_id from `cfarris_copp2`.cpg_sessions where session_id = '8e62837ada521a4ae67125f30ae28a3a' (0s)
        [5] => select user_id as id, user_password as password from `cfarris_copp2`.cpg_users where user_id=1 (0s)
        [6] => SELECT u.user_id AS id, u.user_name AS username, u.user_password AS password, u.user_group+100 AS group_id FROM `cfarris_copp2`.cpg_users AS u INNER JOIN `cfarris_copp2`.cpg_usergroups AS g ON u.user_group=g.group_id WHERE u.user_id='1' (0s)
        [7] => SELECT user_group_list FROM `cfarris_copp2`.cpg_users AS u WHERE user_id='1' and user_group_list <> ''; (0s)
        [8] => SELECT MAX(group_quota) as disk_max, MIN(group_quota) as disk_min, MAX(can_rate_pictures) as can_rate_pictures, MAX(can_send_ecards) as can_send_ecards, MAX(upload_form_config) as ufc_max, MIN(upload_form_config) as ufc_min, MAX(custom_user_upload) as custom_user_upload, MAX(num_file_upload) as num_file_upload, MAX(num_URI_upload) as num_URI_upload, MAX(can_post_comments) as can_post_comments, MAX(can_upload_pictures) as can_upload_pictures, MAX(can_create_albums) as can_create_albums, MAX(has_admin_access) as has_admin_access, MIN(pub_upl_need_approval) as pub_upl_need_approval, MIN( priv_upl_need_approval) as  priv_upl_need_approval FROM cpg_usergroups WHERE group_id in (1) (0s)
        [9] => SELECT group_name FROM  cpg_usergroups WHERE group_id= 1 (0s)
        [10] => update `cfarris_copp2`.cpg_sessions set time='1221592997' where session_id = '8e62837ada521a4ae67125f30ae28a3a' (0s)
        [11] => SELECT user_favpics FROM cpg_favpics WHERE user_id = 1 (0s)
        [12] => DELETE FROM cpg_banned WHERE expiry < '2008-09-16 15:22:54' (0s)
        [13] => SELECT * FROM cpg_banned WHERE (ip_addr='24.60.170.233' OR ip_addr='24.60.170.233' OR user_id=1) AND brute_force=0 (0s)
        [14] => SELECT COUNT(*) FROM cpg_pictures WHERE approved = 'NO' (0s)
        [15] => SELECT COUNT(*) FROM cpg_pictures WHERE ((user4 LIKE '%46%' OR keywords LIKE '%46%' OR caption LIKE '%46%' OR title LIKE '%46%') OR (user4 LIKE '%Plympton%' OR keywords LIKE '%Plympton%' OR caption LIKE '%Plympton%' OR title LIKE '%Plympton%'))  AND approved = 'YES' (0.003s)
        [16] => SELECT * FROM cpg_pictures WHERE ((user4 LIKE '%46%' OR keywords LIKE '%46%' OR caption LIKE '%46%' OR title LIKE '%46%') OR (user4 LIKE '%Plympton%' OR keywords LIKE '%Plympton%' OR caption LIKE '%Plympton%' OR title LIKE '%Plympton%'))  AND approved = 'YES' ORDER BY filename ASC  LIMIT 0 ,350 (0.005s)
    )

    ==========================
    GET :
    ------------------
    Array
    (
        [album] => search
        [type] => full
        [search] => 46 Plympton
    )

    ==========================
    POST :
    ------------------
    Array
    (
        [search] => 46 Plympton
        [params] => Array
            (
                [user4] => 1
                [keywords] => 1
                [caption] => 1
                [title] => 1
            )

    )

    ==========================
    VERSION INFO :
    ------------------
    PHP version: 4.4.7 - OK
    ------------------
    mySQL version: 4.1.22-standard
    ------------------
    Coppermine version: 1.4.18(stable)
    ==========================
    Module: GD
    ------------------
    GD Version: bundled (2.0.28 compatible)
    FreeType Support: 1
    FreeType Linkage: with freetype
    T1Lib Support:
    GIF Read Support: 1
    GIF Create Support: 1
    JPG Support: 1
    PNG Support: 1
    WBMP Support: 1
    XBM Support: 1
    JIS-mapped Japanese Font Support:

    ==========================
    Module: mysql
    ------------------
    MySQL Supportenabled
    Active Persistent Links 0
    Active Links 1
    Client API version 4.1.22
    MYSQL_MODULE_TYPE external
    MYSQL_SOCKET /var/lib/mysql/mysql.sock
    MYSQL_INCLUDE -I/usr/include/mysql
    MYSQL_LIBS -L/usr/lib -lmysqlclient 
    ==========================
    Module: zlib
    ------------------
    ZLib Support enabled
    Compiled Version 1.2.1.2
    Linked Version 1.2.1.2
    ==========================
    Server restrictions (safe mode)?
    ------------------
    Directive | Local Value | Master Value
    safe_mode | Off | Off
    safe_mode_exec_dir | no value | no value
    safe_mode_gid | Off | Off
    safe_mode_include_dir | no value | no value
    safe_mode_exec_dir | no value | no value
    sql.safe_mode | Off | Off
    disable_functions | no value | no value
    file_uploads | On | On
    include_path | .:/usr/lib/php:/usr/local/lib/php | .:/usr/lib/php:/usr/local/lib/php
    open_basedir | /home/cfarris:/usr/lib/php:/usr/local/lib/php:/tmp | no value
    ==========================
    email
    ------------------
    Directive | Local Value | Master Value
    sendmail_from | no value | no value
    sendmail_path | /usr/sbin/sendmail -t -i | /usr/sbin/sendmail -t -i
    SMTP | localhost | localhost
    smtp_port | 25 | 25
    ==========================
    Size and Time
    ------------------
    Directive | Local Value | Master Value
    max_execution_time | 30 | 30
    max_input_time | 60 | 60
    upload_max_filesize | 2M | 2M
    post_max_size | 8M | 8M
    ==========================


    Page generated in 0.105 seconds - 17 queries in 0.008 seconds - Album set : ; Meta set: ;


Nibbler

Quote from: MarianneC on September 15, 2008, 11:16:26 PM
I have it set to default to use the "AND" syntax. So far so good.

You need to do that properly by editing include/search.inc.php

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

Change that to

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

Using the link bypasses the form, so the method you used for your search form won't apply.

MarianneC

Thanks Nibbler.  That did the trick perfectly!