PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Logiciels d'hébergement > mailing.database.mysql > joining two tables for a search engine
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
joining two tables for a search engine

Réponse
 
LinkBack Outils de la discussion
Vieux 23/04/2006, 04h24   #1
none
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut joining two tables for a search engine

I am trying to optimize a search engine.


let's say I have 3 tables. one has titles, one has words, and an index
where each title is broken into words (title_id and word_id)

I want to be able to search terms in any order, so "potter harry" is
the same as "harry potter".

select t.name from titles t, words w, index i where (w.name in
('harry", "potter"))
and (w.word_id = i.id) and (i.title_id = t.id);

This produces a list of titles matching my search times. however, with
over 3 million products, it can be quite slow. 3 seconds is too slow.
sometimes it takes a minute.

is there a better way to do a join when there are more search terms
like "harry potter and the chamber of secrets"?

the fastest way I found was to get the word count for each term, join
on the least used word, and then make sure the remaining terms are in
the titles. but sometimes it returns 10,000+ titles.

what is the best way to do this?

I searched for information on join types but it is way too confusing
for me and does not explain it in a way I can understand.

I am willing to pay via paypal $20 if someone can explain it to me over
the phone in detail.

  Réponse avec citation
Vieux 24/04/2006, 03h58   #2
Michael Austin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: joining two tables for a search engine

none wrote:
> I am trying to optimize a search engine.
>
>
> let's say I have 3 tables. one has titles, one has words, and an index
> where each title is broken into words (title_id and word_id)
>
> I want to be able to search terms in any order, so "potter harry" is
> the same as "harry potter".
>
> select t.name from titles t, words w, index i where (w.name in
> ('harry", "potter"))
> and (w.word_id = i.id) and (i.title_id = t.id);
>
> This produces a list of titles matching my search times. however, with
> over 3 million products, it can be quite slow. 3 seconds is too slow.
> sometimes it takes a minute.
>
> is there a better way to do a join when there are more search terms
> like "harry potter and the chamber of secrets"?
>
> the fastest way I found was to get the word count for each term, join
> on the least used word, and then make sure the remaining terms are in
> the titles. but sometimes it returns 10,000+ titles.
>
> what is the best way to do this?
>
> I searched for information on join types but it is way too confusing
> for me and does not explain it in a way I can understand.
>
> I am willing to pay via paypal $20 if someone can explain it to me over
> the phone in detail.
>


what indexes do you have on the 3 tables? any?

make sure the

create index words_I on words (words,word_id)

hopefully the ids are indexed on the other 2 tables as well.

you could also restructure the query to get:

select c.name from (
select t.name from titles t, words w, index i where (w.name in
('harry', 'potter'))
and (w.word_id = i.id) and (i.title_id = t.id)
) c where strtoupper(t.name) like strtoupper('%harry%potter%');




  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 03h07.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,09004 seconds with 10 queries