Go Back   Pligg Forum > Pligg Development > Pligg Mods
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-02-2006, 03:46 PM
cruci cruci is offline
Casual Pligger
 
Join Date: Oct 2006
Posts: 33
Downloads: 3
Uploads: 0
Thanks: 1
Thanked 3 Times in 2 Posts
search extra fields - solution

No idea if this is the cleanest way of doing this, but it seems to work.

In your /libs/search.php file, look for first line, and then replace as appropriate with this:

Code:
if($SearchMethod == 1){
$where = " AND MATCH (link_url, link_url_title, link_title, link_content, link_tags, link_field1, link_field2, link_field3, link_field4, link_field5, link_field6, link_field7, link_field8) AGAINST ('$words' $mode) ";
}
if($SearchMethod == 2){
$where = " AND (link_url like '%$words%' or link_url_title like '%$words%' or link_title like '%$words%' or link_content like '%$words%' or link_tags like '%$words%' or link_field1 like '%$words%' or link_field1 like '%$words%' or link_field2 like '%$words%' or link_field3 like '%$words%' or link_field4 like '%$words%' or link_field5 like '%$words%') ";
}
}
return $where;
Pretty wordy, but it works for me. I'm not really sure about the difference between search method 1 and 2 (above it mentions something about using method 2 if there are less than 4 characters in the query, but mine seemed to always use method 2), but you can see that it's really just a matter of adding the extra fields into the list of columns that the search looks through.

I have added 8 extra fields to search method 1, but only 5 to search method 2 because it was more work ;> You can of course add as many or as few as you want.
Reply With Quote
Sponsored Links
Check out the New Modules at the Pligg Pro Shop.
  #2 (permalink)  
Old 11-02-2006, 04:27 PM
cruci cruci is offline
Casual Pligger
 
Join Date: Oct 2006
Posts: 33
Downloads: 3
Uploads: 0
Thanks: 1
Thanked 3 Times in 2 Posts
Hmm, found a problem, it doesn't search across fields. So you can't look for a term in field 2 as well as a term in field 3.

I wonder if it is to do with the "or" above. To my logic (Actionscript etc) it needs to be some sort of "and or".

Any PHP guru want to chime in?

I should point out that this is true with the default code, eg if you try to search for a tag & a title (assuming that the tag isn't in the title and vice versa) you will get no results. If you search for either one, you will get results.

Last edited by cruci : 11-02-2006 at 04:31 PM. Reason: statement about original behaviour added
Reply With Quote
  #3 (permalink)  
Old 02-06-2007, 03:20 AM
kanedaguy kanedaguy is offline
Casual Pligger
 
Join Date: Feb 2007
Posts: 70
Downloads: 0
Uploads: 0
Thanks: 6
Thanked 0 Times in 0 Posts
I get this error with this edit of search.php

SQL/DB Error -- [Can't find FULLTEXT index matching the column list]

SQL/DB Error -- [Can't find FULLTEXT index matching the column list]
Reply With Quote
  #4 (permalink)  
Old 02-07-2007, 07:49 AM
kanedaguy kanedaguy is offline
Casual Pligger
 
Join Date: Feb 2007
Posts: 70
Downloads: 0
Uploads: 0
Thanks: 6
Thanked 0 Times in 0 Posts
anybody know what i could do to search extra field 1?
Reply With Quote
  #5 (permalink)  
Old 02-07-2007, 04:46 PM
kbeeveer46's Avatar
kbeeveer46 kbeeveer46 is offline
Pligg Developer/Admin
Pligg Version: 0
Pligg Template: none
 
Join Date: Jun 2006
Location: Muncie, Indiana
Posts: 3,579
Downloads: 62
Uploads: 6
Thanks: 255
Thanked 651 Times in 515 Posts
It doesn't really help you now but the next version of Pligg will search all extra fields automatically. thank Ash for this.
__________________
I accept donations for my time helping users like you on the forum and IRC.

FREE and premium Pligg Web Hosting (NO ads, Includes MySQL, PHP, PHPMyAdmin, and Control Panel) - PM me for discounts on premium packages or if you would like a custom-made package. Paypal accepted.
Reply With Quote
  #6 (permalink)  
Old 04-03-2007, 03:28 PM
michael12happy michael12happy is offline
New Pligger
 
Join Date: Mar 2007
Posts: 21
Downloads: 3
Uploads: 0
Thanks: 1
Thanked 0 Times in 0 Posts
I used pligg 9.0.1
On the admin,
I select
"3 = is a hybrid, using method 1 if possible, but method 2 if needed."

I just added the extra fields
but the
SQL/DB Error -- [Can't find FULLTEXT index matching the column list]
still occurs
any expert to share some tips ?
Reply With Quote
  #7 (permalink)  
Old 04-03-2007, 06:45 PM
michael12happy michael12happy is offline
New Pligger
 
Join Date: Mar 2007
Posts: 21
Downloads: 3
Uploads: 0
Thanks: 1
Thanked 0 Times in 0 Posts
<code>define('Enable_Extra_Field_1', true);
define('Field_1_Title', 'extra field 1');
define('Field_1_Instructions', 'write your extra field 1.');
define('Field_1_Searchable', true);
//the variables below are not yet used in version 6.02.
define('Field_1_Required', true);
define('Field_1_Validation_Method', '');
define('Field_1_Validation_Error_Message', '');
</code>

Although I select "searchable" as true,
SQL/DB Error -- [Can't find FULLTEXT index matching the column list] still appears.

On http://abetter2007.com/story.php?tit...-story-title-2
I've added one extra field : "extra field 1"
extra field 1: result or outcome for extra field

When I search "result" or "result or outcome" or "result or outcome for extra field"
SQL/DB Error -- [Can't find FULLTEXT index matching the column list] still appears.

Please advise
Reply With Quote
  #8 (permalink)  
Old 09-15-2007, 04:26 PM
tangmonkey's Avatar
tangmonkey tangmonkey is offline
New Pligger
 
Join Date: Aug 2007
Posts: 7
Downloads: 11
Uploads: 0
Thanks: 0
Thanked 0 Times in 0 Posts
I just wanted to point out that for the above method to work you need to change Field_X_Searchable to 'true' in /libs/extra_fields.php and change your search method to 2 in admin
Reply With Quote
Reply



Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
search extra fields cruci General Help 1 11-02-2006 04:17 PM
what are extra fields? inggenia General Help 4 10-08-2006 11:51 AM
Extra fields does not work casauxanh Bug Report 1 07-31-2006 01:15 AM
Help with extra fields and/or embeded video validation gram General Help 1 07-22-2006 10:40 PM
Adding extra fields to the submit form. AshDigg Retired Threads 4 02-27-2006 02:56 PM


LinkBacks Enabled by vBSEO 3.0.0