Gossamer Forum
Home : Products : DBMan : Customization :

How to do an AND search with multiple terms?

(Page 2 of 2)
> >
Quote Reply
Re: [Xerin1] How to do an AND search with multiple terms? In reply to
It can work on just one field. It's just that I wrote it to work on a keyword field and now I need to change it.

The first thing you need to do is go through and change back all of the places where you changed "keyword" to "Quote." I'll go take a look at the code again to see what changes I need to make.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] How to do an AND search with multiple terms? In reply to
Thanks, I've already changed everything back to Quote...sorry for the hassle!
Quote Reply
Re: [Xerin1] How to do an AND search with multiple terms? In reply to
Move the code I gave you before to after the line

local (%sortby);

In that section, change every instance of keyword to Quote, so it looks like this:

Code:

# **************************************************************
if ($in{'and'}) {
@terms = split (/ /, $in{'Quote'});
$in{'Quote'} = '(' . $terms[0] . '.*' . $terms[1] . ')|(' . $terms[1] . '.*' . $terms[0] . ')';
$in{'re'} = "on";
}
# **************************************************************


That should do it. I haven't had a chance to work on phrases today.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] How to do an AND search with multiple terms? In reply to
Should I only change the new code from Keyword to quote, or everything in the sub query section? For example, there is a later piece of code like this:

if ($in{'keyword'}) { # If this is a keyword search, we are searching the same
$i = 0; # thing in all fields. Make sure "match any" option is
$in{'ma'} = "on"; # on, otherwise this will almost always fail.
Quote Reply
Re: [Xerin1] How to do an AND search with multiple terms? In reply to
Only the code in this section. Just the lines I posted. We're only applying the "and" search to the one field. If you change the next lines, you'll have the same problem you were having before.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] How to do an AND search with multiple terms? In reply to
It's working perfectly now. Thank you!
Quote Reply
Re: [Xerin1] How to do an AND search with multiple terms? In reply to
I don't seem to be able to work out how to do phrase searches with this. For some reason, it's just not coming. Sorry.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] How to do an AND search with multiple terms? In reply to
It's cool, just being able to search two different words is a huge help. Thanks again!
> >