Jump to content
Killersites Forums

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
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...