Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Search help

Quote Reply
Search help
Hi, could anyone tell me what to do in order for Linksql to be able to search for the word: AT&T.
Quote Reply
Re: [alina] Search help In reply to
This is how I have done something similar:

In Search.pm find the line:

$args->{query} =~ s,^\s*|\s*$,,g;
after this add:

$args->{query} =~ s,&,and,g;

and then in the record for AT&T add ATandT in a field which is searched - I have added a keyword field to my Links table so that I can add extra words which I don't want to include in the description but which I want that listing returned for.
Quote Reply
Re: [afinlr] Search help In reply to
I've been away from this.

Afinir, I've checked and rechecked but could not find

$args->{query} =~ s,^\s*|\s*$,,g;

on search.pm page. Am I missing something?

Thank you for the reply.
Quote Reply
Re: [alina] Search help In reply to
Hi Alina,

Unfortunately I don't think that there is an easy way to do this without modifying core files within Links. The Search.pm file isn't one of your templates - it is a file within the Links installation. I think you will find it in the directory cgi-bin/admin/Links/User

It is not really recommended that you modify these files as they will be overwritten when you upgrade to the next version of Links. However, if you keep a note somewhere of any changes you make then you can quickly add them in again when you upgrade.

If I have misunderstood and you really have looked in Search.pm and can't find the line, let me know and I'll have another look.

Laura.
The UK High Street
Quote Reply
Re: [afinlr] Search help In reply to
Thank you Afinlr.

Yes. I did check again, and still could not find it.

I have version 2.00, and running internal. ( I don't know if it makes any difference). Am I looking at the wrong search.pm?
Quote Reply
Re: [alina] Search help In reply to
Are you sure you have 2.00? That seems quite old? I think things have changed a lot since then.

This is what I have in Search.pm for the start of the query sub:

sub query {
# ------------------------------------------------------------------
# Query the database.
#
my $query = $IN->param('query');
my $term = $IN->escape($IN->param('query'));

# First get our search options.
my $args = $IN->get_hash;
$args->{query} =~ s,^\s*|\s*$,,g;
$args->{query} =~ s,&,and,g; #I've added this line
Quote Reply
Re: [alina] Search help In reply to
Hmm... if you are running 2.0 you really might want to upgrade to the 2.12 version. Lots of changes, fixes, and such.

How easy the upgrade would be, depends on how many plugins and customizations you have made, but to use the new features from GT, and Community, you'll need to upgrade sooner or later.

A *LOT* of things got moved around, switched around, and broken up differently, which is possibly why your code isn't matching up.

If you are going to modify core links code, you _really_ should consider doing it on the 2.12 version, since older versions are substantially different, and if you ever do try to upgrade, later on, you'll find the chore of adding in your tweaks much, much harder.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Search help In reply to
Thank you, Pugdog, for the advice.

Sorry, that was my mistake -I've 2.10. I will consider upgrading for the benefits.

Afinlr pointed out to me that there are two search.pm files. It works now. Thank you again, Afinlr.