Jump to content
Killersites Community
Sign in to follow this  
saversites

How Did You Structure Your Index Mysql Tbl ?

Recommended Posts

Php Buddies,


I'm going to jump into building my own searchengine now.
Starting off with the search box, then the index and then finally the crawler.
Not too worried about the crawler. Gonna make use of cURL and implode,explode, etc. php functions.
It's the Index that I quite can't get my head around.

To build the Index, should I have the structure of the mysql tbl like this .... ?

Option 1

Columns
Url|Keywords

Or, should I make the structure like this instead ..... ?

Option 2

Columns
Keyword|Urls


Option 1a Example

Columns
Url                         |             Keywords
-----------------------------------------------------------------------
devshed.com        |             forum, programming, php

Option 1b Example

Columns
Keyword                                |         Urls
--------------------------------------------------------------------------------------------------------------------------
forum                                     |         devshed.com, blackhat.com, warriorforum.com
---------------------------------------------------------------------------------------------------------------------------
php                                        |         devshed.com/forum/php.htm, sitepoint.com/forum/php.php

 

Option 2a Example

Columns
Urls                               |             Keyword
-----------------------------------------------------------------------
devshed.com              |             forum
-----------------------------------------------------------------------
devshed.com              |             programming
-----------------------------------------------------------------------
warriorforum.com        |             money
-----------------------------------------------------------------------
warriorforum.com        |             forum

 

Option 2b Example

Columns
Keywords                                |         Urls
--------------------------------------------------------------------------------------------------------------------------
forum                                     |         devshed.com/forum
--------------------------------------------------------------------------------------------------------------------------
forum                                     |         blackhat.com/forum
---------------------------------------------------------------------------------------------------------------------------
php                                        |         devshed.com/forum/php.htm
---------------------------------------------------------------------------------------------------------------------------
php                                        |         sitepoint.com/forum/php.php


Question 1:
I have a feeling you won't like Option 1a or 1b atall.
But, let's assume you need to do it out of them 2 options. Which one would you choose ?

Question 2:
I have a feeling you will like Option 2a or 2b.
Which one would you choose ?
Or, if you don't like any of them 2. Then, let's assume you need to do it out of them 2 options. Which one would you choose ?

Question 3:
If you don't like the structure of any of the 4 options then which structure would you yourself use or have used ?
Best to show an example like I did.


Btw, I know that, if I structure my tbl around the way I showed in my examples then users would only be able to make queires for a single keyword and not a phrase. But, dealing with phrases get complicated and so for the time being, as a beginner, let's concentrate one thing at a time. Concentrate on the very first basic of indexing a url.

Thanks

Edited by saversites

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×