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: keyword AND in $source  (Read 5756 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.02 seconds with 20 queries.