Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2011-11-17 16:11:41
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Enhanced Search Functionality
I have a request to enhance the search feature/functionality of TXP on a current site. The client has asked that the search weight item that are in the Article Title more than the body of the actual article. I was wondering if anyone had come across the need for such functionality.
Thanks.
progre55
Offline
#2 2011-11-17 17:30:48
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,315
Re: Enhanced Search Functionality
Hm, this might be totally stupid, but you could test altering the order of Body
and Title
in two spots of the core files:
- In textpattern/publish/search.php line 33
- In textpattern/publish.php in line 674
And you’ll do it in a sandbox installation, promise ;)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#3 2011-11-22 21:06:38
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Re: Enhanced Search Functionality
Uli:
Sorry for the delayed response — I am going to give it try and see —- I will let you know —
Thanks.
progre55
Offline
#4 2011-11-23 16:10:22
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Re: Enhanced Search Functionality
Uli:
I think I need a little more direction — I know — you would think line numbers would be enough — either I am switching the wrong thing or something is not right — because I cannot get it to function —-
progre55
Offline
#5 2011-11-23 16:46:20
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,315
Re: Enhanced Search Functionality
You’ll probably have done it correctly, and it simply doesn’t work. Just in order to be sure:
Let’s begin with textpattern/publish/search.php
line 33
Find
match (Title,Body) against ('$q') as score",
change to
match (Body,Title) against ('$q') as score",
Next textpattern/publish.php
in line 674
find
if (empty($cols) or $cols[0] == '') $cols = array('Title', 'Body');
change to
if (empty($cols) or $cols[0] == '') $cols = array('Body', 'Title');
The ocurrences in both files can only be found one time, so it should be rather unambiguous.
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#6 2011-11-28 16:44:39
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Re: Enhanced Search Functionality
Uli:
Unfortunately, no dice. It does not weight items so that search terms in the Article Title more than the body of the actual article.
Any other thoughts :)
progre55
Offline
Re: Enhanced Search Functionality
Hm, I think you could probably use adi_gps
and smd_query
to create your own little search functionality (using ORDER BY
perhaps? I’m no MySQL guru) and get the result you want.
Offline
Pages: 1