This forum is in archive mode. You will not be able to post new content.

Author Topic: Search engine  (Read 1739 times)

0 Members and 1 Guest are viewing this topic.

Offline Phage

  • VIP
  • Overlord
  • *
  • Posts: 1280
  • Cookies: 120
    • View Profile
Search engine
« on: August 05, 2012, 10:10:23 PM »
Hmm i know that i have maked a thread on almost the same topic, but it wasn't working for me and i want to start form scratch here.

I'm currently remaking my site and decided to make my own search function (not a third party one). The problem is that the php search engines i have found or used wasn't working. So therefore i'm asking you about how to setup my own php search engine on my website.

I do not know any php so i know this was kind of stupid, but i want to learn, and i'm bussy with learning c++ right now so i do not have the time to learn php at the moment.

So i know that some of you guys probertly are going to say wait until you have learned some php, but i need this right now and as i mentioned i do not have the time to learn php.
"Ruby devs do, in fact, get all the girls. No girl wants a python, but EVERY girl wants rubies" - connection

"It always takes longer than you expect, even when you take into account Hofstadter’s Law."

Offline ca0s

  • VIP
  • Sir
  • *
  • Posts: 432
  • Cookies: 53
    • View Profile
    • ka0labs #
Re: Search engine
« Reply #1 on: August 05, 2012, 10:58:31 PM »
If it is for your own website, you have two options:
- Maintain a database with the content and search in it.
- Crawl your own website and store results (we had a contest about that, look for it).
I think the first one will be the best for you. If you are already storing your content in a db just do a bunch of SQL queries like
Code: [Select]
SELECT * FROM articles WHERE topic LIKE '%cleanQuery% OR text LIKE '%cleanQuery%'
SELECT * FROM comments WHERE comment LIKE '%cleanQuery' or author LIKE '%cleanQuery%'
Etc.
Edit: I fully read your post. Sorry, I can't give you copy&use code right now. However, this is a really simple task. Spend 2 days learning PHP+SQL basics and you will probably come up with something :)
« Last Edit: August 05, 2012, 11:00:13 PM by ca0s »

Offline Phage

  • VIP
  • Overlord
  • *
  • Posts: 1280
  • Cookies: 120
    • View Profile
Re: Search engine
« Reply #2 on: August 05, 2012, 11:16:53 PM »
Thank you for your reply, the problem is that i do not use any SQL db, because i want to keep it as simple as possible.
"Ruby devs do, in fact, get all the girls. No girl wants a python, but EVERY girl wants rubies" - connection

"It always takes longer than you expect, even when you take into account Hofstadter’s Law."

Offline techb

  • Soy Sauce Feeler
  • Global Moderator
  • King
  • *
  • Posts: 2350
  • Cookies: 345
  • Aliens do in fact wear hats.
    • View Profile
    • github
Re: Search engine
« Reply #3 on: August 05, 2012, 11:36:20 PM »
Thank you for your reply, the problem is that i do not use any SQL db, because i want to keep it as simple as possible.

Then you could go with the crawl method. Include tags on pages of everything the page/post is about. Match search terms a against all the tags. Regular expressions could come in handy also, for when your comfortable with the language.

For simplicity, make sure to sanitize the input input. Such as making it all lower case,  stripping punctuation, etc. It will make things easier for the searching.
>>>import this
-----------------------------

Offline Stackprotector

  • Administrator
  • Titan
  • *
  • Posts: 2515
  • Cookies: 205
    • View Profile
Re: Search engine
« Reply #4 on: August 06, 2012, 01:37:14 PM »
Thank you for your reply, the problem is that i do not use any SQL db, because i want to keep it as simple as possible.
There are reasons in this world why a DB is invented, BECAUSE IT IS LESS WORK.
~Factionwars

Offline Phage

  • VIP
  • Overlord
  • *
  • Posts: 1280
  • Cookies: 120
    • View Profile
Re: Search engine
« Reply #5 on: August 06, 2012, 03:08:32 PM »
yeah, i'm probertly also going to use the SQL db.
"Ruby devs do, in fact, get all the girls. No girl wants a python, but EVERY girl wants rubies" - connection

"It always takes longer than you expect, even when you take into account Hofstadter’s Law."

 



Want to be here? Contact Ande, Factionwars or Kulverstukas on the forum or at IRC.