1
freakingid
Making xyp4All Searchable?
  • 2006/2/22 19:40

  • freakingid

  • Just popping in

  • Posts: 10

  • Since: 2005/8/18


I like the xyp4all module, to be used for our City's "Contact Us" section.

The one vital thing it is missing for us, however, is integration into XOOPS search function.

Is there an easy way to have XOOPS search search the contacts?

Is there a different similar module that is xoops-searchable?

2
zyspec
Re: Making xyp4All Searchable?
  • 2006/2/23 2:08

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


Which version of xyp4all are you using? I have 1.58 installed on one of my sites and it does link into the XOOPS search engine. It does appear to need some tweaking as I believe it only finds words in the Name and Description fields - so it doesn't find anything in the address, phone number, etc. fields.

I haven't looked at the code but I'm sure it wouldn't be too difficult to add additional fields to the search criteria.

By the way the text returned from the search (that shows up in the search results) in my installation only shows the category and doesn't show the Name, etc. of the business. I'll have to look into that now that I've noticed it...

By the way "Go Illini!"

3
zyspec
Re: Making xyp4All Searchable?
  • 2006/2/23 22:19

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


Okay, upon further review of the search function in xyp4all (ver 1.58) there's a couple of bugs that causes unexpected behavior and then there's some "logic" which causes the display of the search to only show the title of the category the item is in, instead of showing the item title.

Currently the search only attempts to search the Contact Name, the Category and the Description fields.

With some work it could be made to search more fields and by modifying the SQL statements actually show the Contact Name instead of just the Category when it does find a match.

One "easy" bug to fix to improve the search results is change line 45 from:
$sql .= "(l.title LIKE '%$queryarray[$i]%' OR c.title LIKE '%$queryarray[0]%' OR t.description LIKE '%$queryarray[$i]%')";

to:
$sql .= "(l.title LIKE '%$queryarray[$i]%' OR c.title LIKE '%$queryarray[i]%' OR t.description LIKE '%$queryarray[$i]%')";

4
Liger
Re: Making xyp4All Searchable?
  • 2006/3/14 16:45

  • Liger

  • Just popping in

  • Posts: 77

  • Since: 2006/1/26


zyspec, May I ask where you found and downloaded xyp4all (ver 1.58)?

-JP
Americans for Fair Taxation http://www.fairtax.org

5
zyspec
Re: Making xyp4All Searchable?
  • 2006/3/15 19:29

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


I got it from here... Be aware - it's an RC, not an "official" release. Also npte that the search function doesn't work quite right. I've sent the author the changes I made to get it to work the way I want. Just PM me if you'd like to see the changes I made to get it to work.

6
zyspec
Re: Making xyp4All Searchable?
  • 2006/3/20 21:22

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


Okay... I've had several people successfully "patch" the include/search.inc.php file in both version 1.57 and 1.58 RC so I'll post the changes I made to get the search to work as intended.

The first change makes the search return the title from the xyp_links table instead of the category title. The sql was inadvertently overwriting the title from the xyp_links table with the title from the xyp_cat table since they both have the same name.

Change line 35 FROM:
$sql = "SELECT l.lid,l.cid,l.title,l.submitter,l.date,c.title,t.description FROM ".$xoopsDB->prefix("xyp_links")." l LEFT JOIN ".$xoopsDB->prefix("xyp_cat")." c ON c.cid=l.cid LEFT JOIN ".$xoopsDB->prefix("xyp_text")." t ON t.lid=l.lid WHERE status>0";

TO:
$sql = "SELECT l.lid,l.cid,l.title,l.submitter,l.date,c.title AS cattitle,t.description FROM ".$xoopsDB->prefix("xyp_links")." l LEFT JOIN ".$xoopsDB->prefix("xyp_cat")." c ON c.cid=l.cid LEFT JOIN ".$xoopsDB->prefix("xyp_text")." t ON t.lid=l.lid WHERE status>0";

The second change updates the LIKE terms of the sql statement when the queryarray has more than 1 item. It looks like this was inadvertently left from a "cut and paste" operation.

Change line 45 FROM:
$sql .= "(l.title LIKE '%$queryarray[$i]%' OR c.title LIKE '%$queryarray[0]%' OR t.description LIKE '%$queryarray[$i]%')";

to:
$sql .= "(l.title LIKE '%$queryarray[$i]%' OR c.title LIKE '%$queryarray[$i]%' OR t.description LIKE '%$queryarray[$i]%')";

7
Liger
Re: Making xyp4All Searchable?
  • 2006/3/20 22:35

  • Liger

  • Just popping in

  • Posts: 77

  • Since: 2006/1/26


zyspec, Thanx again for the hard work

-JP
Americans for Fair Taxation http://www.fairtax.org

8
fungus
Re: Making xyp4All Searchable?
  • 2007/1/11 11:19

  • fungus

  • Just popping in

  • Posts: 72

  • Since: 2002/10/15


I think this is somewhat related...

How do you get it to do a postcode search, I have tried to get xyp4all and xdirectory but both do not seem to be able to do zip/postcodes searches.

I am getting frustrated as these programmes are fantastic.

any help greatly appreciated.

Regards
fungus
Hmmm... Why do I have so many screws left over?

9
fungus
Re: Making xyp4All Searchable?
  • 2007/1/11 13:09

  • fungus

  • Just popping in

  • Posts: 72

  • Since: 2002/10/15


Actually I got it...after an hour or so...
I edited the search file under the module directory .... xyp4all/includes/search.inc.php

Changed line 35:
$sql = "SELECT l.lid,l.cid,l.title,l.submitter,l.zip,l.date,c.title AS cattitle,t.description FROM ".$xoopsDB->prefix("xyp_links")." l LEFT JOIN ".$xoopsDB->prefix("xyp_cat")." c ON c.cid=l.cid LEFT JOIN ".$xoopsDB->prefix("xyp_text")." t ON t.lid=l.lid WHERE status>0";

Changed line 42-45:
$sql .= " AND ((l.title LIKE '%$queryarray[0]%' OR c.title LIKE '%$queryarray[0]%' OR l.zip LIKE '%$queryarray[0]%' OR t.description LIKE '%$queryarray[0]%')";
for($i=1;$i<$count;$i++){
$sql .= " $andor ";
$sql .= "(l.title LIKE '%$queryarray[$i]%' OR c.title LIKE '%$queryarray[$i]%' OR l.zip LIKE '%$queryarray[$i]%' OR t.description LIKE '%$queryarray[$i]%')";

note the added "l.zip" queries.

Please note:
I do not think of myself as a php or MySql Guru so I just fluked it (or better still just used logic from the above mentioned patch). I just needed a postcode/zipcode search, and if anyone else needs help I am sure I can for a small fee
Hmmm... Why do I have so many screws left over?

10
fungus
Re: Making xyp4All Searchable?
  • 2007/1/14 4:36

  • fungus

  • Just popping in

  • Posts: 72

  • Since: 2002/10/15


Also I got the search to work with whereis.com.au for the Australian addreses (this is a mod specifically I ported for Australian use).

If anyone needs help, give us a yell...
Hmmm... Why do I have so many screws left over?

Login

Who's Online

474 user(s) are online (383 user(s) are browsing Support Forums)


Members: 0


Guests: 474


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