1
ibzan
Search function
  • 2003/11/3 9:27

  • ibzan

  • Just popping in

  • Posts: 48

  • Since: 2003/8/31


I have a modified module based of mydownloads and recently noticed that when I use the search function that is does find content in the body, or rather, the description however is fails to search within the platform tables.

Is there a way to include this field so that the search function would not pass it over?

Chris

2
ibzan
Re: Search function
  • 2003/11/3 9:44

  • ibzan

  • Just popping in

  • Posts: 48

  • Since: 2003/8/31


Ok, I found the search.inc.php file and added d.platform (the field I want included in the search) and updated the module. However I am still coming up short...


3
onokazu
Re: Search function
  • 2003/11/3 9:50

  • onokazu

  • XOOPS Founder

  • Posts: 617

  • Since: 2001/12/13


You need to change the following line

d.title LIKE '%$queryarray[$i]%' OR t.description LIKE '%$queryarray[$i]%'

to

d.platform '%$queryarray[$i]%' OR LIKE d.title LIKE '%$queryarray[$i]%' OR t.description LIKE '%$queryarray[$i]%'

There are 2 similar lines in the file, so you need to change both.

4
ibzan
Re: Search function
  • 2003/11/3 10:11

  • ibzan

  • Just popping in

  • Posts: 48

  • Since: 2003/8/31


I did like you said:

Quote:

onokazu wrote:
You need to change the following line

d.title LIKE '%$queryarray[$i]%' OR t.description LIKE '%$queryarray[$i]%'

to

d.platform '%$queryarray[$i]%' OR LIKE d.title LIKE '%$queryarray[$i]%' OR t.description LIKE '%$queryarray[$i]%'

There are 2 similar lines in the file, so you need to change both.


But I still don't get anything.

When I changed the d.title to d.platform, of course that field started showing, however with the other now excluded.

5
ibzan
Re: Search function
  • 2003/11/3 10:24

  • ibzan

  • Just popping in

  • Posts: 48

  • Since: 2003/8/31


I played around with your string:

Quote:
d.platform '%$queryarray[$i]%' OR LIKE d.title LIKE '%$queryarray[$i]%' OR t.description LIKE '%$queryarray[$i]%'


and came up with the following that seems to work:

Quote:
d.platform LIKE '%$queryarray[$i]%' AND d.title LIKE '%$queryarray[$i]%' OR t.description LIKE '%$queryarray[$i]%'

6
onokazu
Re: Search function
  • 2003/11/3 10:25

  • onokazu

  • XOOPS Founder

  • Posts: 617

  • Since: 2001/12/13


If you want to display platform names in the search results, then change the following line

SELECT d.lid,d.cid,d.title,d.submitter,d.date,t.description

to

SELECT d.lid,d.cid,d.title,d.submitter,d.date,t.description,d.platform

and

$ret[$i]['title'] = $myrow['title'];

to somethins like below

$ret[$i]['title'] = $myrow['title'].'('.$myrow['platform'].')';

Hope this helps.

7
ibzan
Re: Search function
  • 2003/11/3 10:35

  • ibzan

  • Just popping in

  • Posts: 48

  • Since: 2003/8/31


Though I had it working, I did try your suggestion - didn't work, but thanks anyway!

I do have one question though about the slight difference between the string I started with (the first of the two lines in that particular file):
Quote:
d.title LIKE '%$queryarray[0]%' OR t.description LIKE '%$queryarray[0]%'


and what I ended up with that appears to work:
Quote:
d.platform LIKE '%$queryarray[$i]%' AND d.title LIKE '%$queryarray[$i]%' OR t.description LIKE '%$queryarray[$i]%'


The first one had the '%$queryarray[0]%', the second had [0] replaced with [i].
What doesn't make sence to me is that, what would seem logical is what was the value of [0] would remain [0] and not [i]. Anyhow, I wouldn't have stumbled on that had you not given me the first bit of info.

Thanks!

Chris

8
ibzan
Re: Search function
  • 2003/11/3 10:42

  • ibzan

  • Just popping in

  • Posts: 48

  • Since: 2003/8/31


The saga continues.

The AND statement is pulling in all the records though the platform is not there.

...

9
ibzan
Re: Search function
  • 2003/11/3 10:59

  • ibzan

  • Just popping in

  • Posts: 48

  • Since: 2003/8/31


I finally figured it out:

Quote:
d.platform LIKE '%$queryarray[0]%' OR d.title LIKE '%$queryarray[0]%' OR t.description LIKE '%$queryarray[0]%'


That should do it.

Chris

Login

Who's Online

157 user(s) are online (89 user(s) are browsing Support Forums)


Members: 0


Guests: 157


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits