coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: MarianneC on September 15, 2008, 11:16:26 PM

Title: [Solved]: Search Syntax Question
Post by: MarianneC on September 15, 2008, 11:16:26 PM
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
Title: Re: Search Syntax Question
Post by: Nibbler on September 16, 2008, 08:46:17 PM
Can you enable debug mode in config and post the debug output you get at the search results page please?
Title: Re: Search Syntax Question
Post by: MarianneC on September 16, 2008, 09:26:07 PM
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
        (
           
Title: Re: Search Syntax Question
Post by: Nibbler on September 16, 2008, 09:53:21 PM
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.
Title: Re: Search Syntax Question
Post by: MarianneC on September 17, 2008, 12:19:06 AM
Thanks Nibbler.  That did the trick perfectly!