Advanced search  

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]

Pages: [1]   Go Down

Author Topic: keyword AND in $source  (Read 5182 times)

0 Members and 1 Guest are viewing this topic.

taraAthan

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
keyword AND in $source
« on: January 04, 2008, 06:28:47 pm »

I would like to search for two or more keywords with an AND option instead of OR. That is: match all of these keywords.  I was wondering if anyone has modified the cpmfetch code to do this (before I attempt to do it myself).

Thanks, Tara
Logged

taraAthan

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: keyword AND in $source
« Reply #1 on: January 05, 2008, 01:01:16 am »

Okay, I made the modifications to add an option to "match all of these keywords".  It wasn't too hard, as the code in cpmfetch is well-written and easy to follow   ;D. The only file that had to be modified was cpmfetch_dao.php - the modified file is attached as a zip.

My solution is perhaps not very elegant- I just added a new option to the $source parameter called keywordand. It works basically the same way as keyword, but puts ANDS in between instead of OR. You can still have the OR style keyword search as well, so it is possible to construct a complex keyword query that looks like this

keywords like  a OR b OR (x AND y AND z)

although I'm not sure why you would want to do that ???

In case you are interested, I am using this for a faceted search, where I have keywords such as
event.Ludwigia_field_tour and ecotype.riparian_woodland.  The part before the . is the name of the facet.
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: keyword AND in $source
« Reply #2 on: January 06, 2008, 11:40:06 pm »

Okay, I made the modifications to add an option to "match all of these keywords".  It wasn't too hard, as the code in cpmfetch is well-written and easy to follow   ;D. The only file that had to be modified was cpmfetch_dao.php - the modified file is attached as a zip.

My solution is perhaps not very elegant- I just added a new option to the $source parameter called keywordand. It works basically the same way as keyword, but puts ANDS in between instead of OR. You can still have the OR style keyword search as well, so it is possible to construct a complex keyword query that looks like this

keywords like  a OR b OR (x AND y AND z)

although I'm not sure why you would want to do that ???

In case you are interested, I am using this for a faceted search, where I have keywords such as
event.Ludwigia_field_tour and ecotype.riparian_woodland.  The part before the . is the name of the facet.

Interesting... thanks for posting!

Vuud
Logged
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

cambiasso

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: keyword AND in $source
« Reply #3 on: November 28, 2009, 04:14:28 pm »

Okay, I made the modifications to add an option to "match all of these keywords". 

I Love You !!!!  :-*  :-*

GRAZIE!!!!  ;)
Logged
Pages: [1]   Go Up
 

Page created in 0.019 seconds with 19 queries.