Gossamer Forum
Home : Products : Links 2.0 : Customization :

Getting more relavent search results

(Page 1 of 2)
> >
Quote Reply
Getting more relavent search results
Is there a way to get more accurate search results for the words my users type in? For example: If I would type in the search term "ham" it would return the word "champion" as a result, just because the word ham is in champion. Is there a way to fix this so that ham only returns ham, not champion?

Also is it possible that in order to return something as a search result, the term must be in the title AND description?
Quote Reply
Re: Getting more relavent search results In reply to
Advise users to do this: -

In the advanced search, to find an exact word, put a space before and after it in the box - and search as a phrase!

Then you will see the results you want.



------------------
HumorLinks Comedy Megasite, Search Engine, Humor DVD and Video Store

http://humorlinks.com/

humorlinks@humorlinks.com

[This message has been edited by humorlinks (edited July 17, 1999).]
Quote Reply
Re: Getting more relavent search results In reply to
A very clever solution, humorlinks. But I that's still a work-around. I agree that there should be some way to search for the exact word. Since Jerry has been fooling around with search.cgi lately, perhaps he can come up with something? Smile
Quote Reply
Re: Getting more relavent search results In reply to
How do the big search engines get round this problem? Surely the ability to find a distinct word (as opposed to bits and pieces of larger words) is a fundamental feature of any decent search. There must be a MOD for the Links 2.0 search engine which will improve its functionality. We tried playing around with search.cgi, but discovered we were out of our depth, somewhat.



------------------
HumorLinks Comedy Megasite, Search Engine, Humor DVD and Video Store

http://humorlinks.com/

humorlinks@humorlinks.com
Quote Reply
Re: Getting more relavent search results In reply to
I can tell you some of the many techniques used to rank search results at large search engines but I am far from adept enough to make these modifications to the search script my self. If someone could do these it would be one of the most useful links modifications especially for SQL users with large data base's. Here are the techniques I know that search engines use:

1. See if parts of the search word is in the title.
2. See if the search term is in the URL.
3. See how many people link to that site in there data base.
4. Number of times it was submitted.
5. See if search term is in the text of the page or the first paragraph.
6. Keywords and description meta tags.
7. Submission date.

Now how I see it the best way to rank them(for links users) would be by a points system like this:

1. All the links start with 0 points.
2. (only applies to sites with 10 votes) If they are rated a 1 then they get 1 point if they are rated a 9 then they get 9 points.
3. If one of the search terms is in the title of the site add 3 points.
4. Add one point for every time one of the search terms appears in the URL, description, reviews(if you have review it mod) and so on.
5. 5 point if the hole search term is in the keywords.
6. 1 point if part of the search term is in the keyword field.

You could change the points I just used these for the example.

Then rank sites by points if there is a tie on points then rank them by witch one in newer.

Well I know that seams really complicated buy if you could do it in my opinion you would give some of the best search results on the web.

Well if anyone is interested in trying to make this mod I would be willing to help them in any way possible.




------------------
Thanks,
Steven Bond
Webmaster for:
Search4info.com and Blur-online.com
"The real danger is not that computers will begin to think like men, but that men will begin to think like computers."
-Unknown
Quote Reply
Re: Getting more relavent search results In reply to
if you want exact word matching, here is a simple mod.

In the search.cgi, in the sub search you just need to change two lines

change
Code:
# Field names you want to allow visitors to search on:
@search_fields = (1,2,5);

Good Luck,



------------------
Ken Chidlow
chidlow@gossamer-threads.com
Quote Reply
Re: Getting more relavent search results In reply to
That didn't work for me

------------------
------------------------------------------
Lavon Russell
LookHard! Search
http://www.lh.yi.org
webmaster@lh.yi.org
Quote Reply
Re: Getting more relavent search results In reply to
That's a interesting work around but it really doesn't solve the problem. Links needs to sort by relevancy. Well as I stated in 3 other posts I will be glad to help develop this if someone else will help.

Steven

Quote Reply
Re: Getting more relavent search results In reply to
Hi Lavon,
What didn't work? Could you still search and get the results you got before the mod, ie if you do a search on ham, did it return champion as a hit, or does it not return anything? I know it worked for bocyber.




------------------
Ken Chidlow
chidlow@gossamer-threads.com
Quote Reply
Re: Getting more relavent search results In reply to
Hi Steven,
I thought I would warn you up front, the reason why the searching is not not done by relevancy, and is not par with the rest of the program, is that searching large flat file databases is really slow. Really slow. Ok, so snails move faster.

To speed it up I would suggest indexing, which is a one time thing, but could take hours. I had to index a flat file before, and it took me 35 min for 4000 links, then got exponentially slower.

There is better searching in SQL, and that has plans to be improved in the next month or so.

Just thought I would warn you on what your getting into.

Ken


------------------
Ken Chidlow
chidlow@gossamer-threads.com
Quote Reply
Re: Getting more relavent search results In reply to
The way I would ideally like to do it as far as i can see wouldn't slow it down very much. In my option the best way to do it would be to have the normal links script get the normal search results then just rank those by the points system... Am I wrong would this cause a major slow down?

Steven
Quote Reply
Re: Getting more relavent search results In reply to
Your idea would only cause a slowdown on queries with large results. Say you had a search that returned 1000 results. You would have to figure out the score for each link, then sort them by there score. This would be fine on small numbers of results.

Ken

------------------
Ken Chidlow
chidlow@gossamer-threads.com
Quote Reply
Re: Getting more relavent search results In reply to
Hello, chidlow.

Nice modification (and simple) for the search engine. I was wondering if you or anyone else has tried to set up if/else or unless statements that would allow users to specify in the search form if they want an exact word search. For example, a checkbox could be placed on the "Advanced Search Form" that would allow people to check it before submitting their search.

If you have any pointers on how to set this up, I would greatly appreciate it. Smile

TIA.

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Getting more relavent search results In reply to
Have you looked at what webcrawler is doing with their popular search terms?

Pretty slick, and gives people ideas. The truly lame can just sit and just watch the search box!
Quote Reply
Re: Getting more relavent search results In reply to
Hi Eliot,
In your search.html template add the line:
Code:
# Save the reg expressions to avoid rebuilding.
$or_match = $bool ne 'and';
if ($or_match) {
for (0 .. $#{$search_terms}) {
next if (length ${$search_terms}[$_] < 2); # Skip single letter words.

$in{'exact'} ?
$tmp .= "m/\\b\Q${$search_terms}[$_]\E\\b/io &#0124; &#0124;" :
$tmp .= "m/\Q${$search_terms}[$_]\E/io &#0124; &#0124;" ;
}
}
else {
for (0 .. $#{$search_terms}) {
next if (length ${$search_terms}[$_] < 2); # Skip single letter words.
$in{'exact'} ?
$tmp .= "m/\\b\Q${$search_terms}[$_]\E\\b/io &&":
$tmp .= "m/\Q${$search_terms}[$_]\E/io &&" ;
}
}
chop ($tmp); chop ($tmp);


I didn't really test it, but it seems right.

Let me know if it doesn't work.

Ken


------------------
Ken Chidlow
chidlow@gossamer-threads.com
Quote Reply
Re: Getting more relavent search results In reply to
Thanks, chidlow. I'll try it right now.

Update: Well, it sort of worked. I searched for "Mesoamerica" with the checkbox checked. The results I received included all results that included Mesoamerica, including:
Mesoamerican. Is this how your mod is supposed to work? If not, could the radio buttons: 1) Keywords, and 2) As Phrase conflict with this mod?

Thanks for your assistance. It is truly refreshing to see cooperativeness and support in this forum.

Smile

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited August 06, 1999).]
Quote Reply
Re: Getting more relavent search results In reply to
Hey pug, I am going to do the same thing as soon as i get my keyword logger straight. Ken, the exact word worked for me, search tele=>television

------------------
------------------------------------------
Lavon Russell
LookHard! Search
http://www.lh.yi.org
webmaster@lh.yi.org
Quote Reply
Re: Getting more relavent search results In reply to
Here's another thing to look at --

http://keilor.cs.umass.edu/pluribus/index.php3

It's a script that learns as it goes along. Uses MySQL and PHP, but might provide some ideas.
Quote Reply
Re: Getting more relavent search results In reply to
Hi Eliot,
When the check box is checked, you should only get links that have the exact word in it. I didn't take care of the bolding in my mod, so it bolds the substrings in the links that do have the exact word. Clear as mud.

If you have 3 links, one with the word 'ham', one with the word 'champ' and the third with both words. If you do an exact search right now on 'ham', you will get two links, not three. But there is a bug in that the link that has both words will actually have both words highlighted, not just 'ham'.

That can be changed (fixed), so if you feel confortable, you can attempt it. If nobody posts the solution today, I will do it tommorrow morning (Aug. 10th). I'm just to busy today.

If that's not what the problem is, then let me know, and send me an email with a url.
Smile

Thanks,
Ken



------------------
Ken Chidlow
chidlow@gossamer-threads.com
Quote Reply
Re: Getting more relavent search results In reply to
Childlow,

That is the problem...bolding. Smile If you are willing and able, I would greatly appreciate the codes that would solve the bolding problem.

Thanks.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Getting more relavent search results In reply to
Hi Eliot,
In search.cgi change following the lines
Code:
$link_results =~ s,(<[^>]+> )|(\Q$term\E),defined($1) ? $1 : "<STRONG>$2</STRONG>",gie;
$category_results =~ s,(<[^>]+> )|(\Q$term\E),defined($1) ? $1 : "<STRONG>$2</STRONG>",gie;

to...

Code:
if ($in{'exact'}) {
$link_results =~ s,(<[^>]+> )|(\b\Q$term\E\b),defined($1) ? $1 : "<STRONG>$2</STRONG>",gie;
$category_results =~ s,(<[^>]+> )|(\b\Q$term\E\b),defined($1) ? $1 : "<STRONG>$2</STRONG>",gie;
}
else {
$link_results =~ s,(<[^>]+> )|(\Q$term\E),defined($1) ? $1 : "<STRONG>$2</STRONG>",gie;
$category_results =~ s,(<[^>]+> )|(\Q$term\E),defined($1) ? $1 : "<STRONG>$2</STRONG>",gie;
}

Again, I haven't tested it, so let me know if it doesn't work.

***I just edited the code, there was an extra space in it that cause the strong tags to show up in too many places.
The spaces come from using the UBB code tags.

If there is a space after the +> take it out!
Ken

------------------
Ken Chidlow
chidlow@gossamer-threads.com

[This message has been edited by chidlow (edited August 18, 1999).]
Quote Reply
Re: Getting more relavent search results In reply to
childlow,

I will test it tonight when I am home...I mainly use LINKS for outside projects. So, I can't really test it at the office. But I really appreciate your assistance.

Thanks. Smile

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Getting more relavent search results In reply to
Thanks, childlow, however, the bolding does not work for the exact word result. It still works for the "regular" search. But when I select the "Exact Word" option, the bolding does not appear...

Hmm...

But, thanks again for the effort.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Getting more relavent search results In reply to
Hi Eliot,
It works for me...can you email me a url, and ftp access so that I can see what is going on? (*do not post the ftp info*)

Please note that my last name is Chidlow, not childlow. Your tossing in an extra 'l', and I wouldn't receive the email.

Thanks,
Ken

------------------
Ken Chidlow
chidlow@gossamer-threads.com
Quote Reply
Re: Getting more relavent search results In reply to
The exact word search work for
me perfectly..

...
thanks......
> >