Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,473
There are 1951 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

Site Search

Thread title: Site Search
Reply    
    Thread tools Search this thread Display Modes  
07-14-2009, 07:42 PM
#1
insub2 is offline insub2
Status: Member
Join date: Jun 2007
Location:
Expertise:
Software:
 
Posts: 136
iTrader: 1 / 100%
 

insub2 is on a distinguished road

Send a message via AIM to insub2

  Old  Site Search

I've got a client that wants a pretty complicated search engine built into their website. I was wondering if any of you smart people had any reading recommendations? I have some idea of what I would like to do but am looking for a "best practices" type approach. Thanks.

Reply With Quote
07-14-2009, 07:54 PM
#2
jnadeau is offline jnadeau
Status: I'm new around here
Join date: Jan 2008
Location: Detroit Area
Expertise:
Software:
 
Posts: 23
iTrader: 0 / 0%
 

jnadeau is on a distinguished road

Send a message via AIM to jnadeau Send a message via MSN to jnadeau Send a message via Skype™ to jnadeau

  Old

That really really depends on what kind of content you have and how it is structured in the DB. A lot of developers who don't have a lot of database knowledge will fail to index fields properly which makes selection slow.

Basically, if you have a field that you might be selecting against, add it as an index. If it's certain to be unique for each record, make it a unique index. If you have bodies of text that you want searchable, add FULLTEXT indices to those fields and read up on how to do FULLTEXT searches http://dev.mysql.com/doc/refman/5.0/...xt-search.html

Be sure to check your queries with EXPLAIN to see if they're as efficient as they could be. If you're still not sure on how you'd implement the above, post with some more info on what kind of data you need searched.

Reply With Quote
07-31-2009, 12:39 AM
#3
insub2 is offline insub2
Status: Member
Join date: Jun 2007
Location:
Expertise:
Software:
 
Posts: 136
iTrader: 1 / 100%
 

insub2 is on a distinguished road

Send a message via AIM to insub2

  Old

Well, I would like to have the conventional quote marks for exact phrases, the OR, minus sign for not. However, I'm not sure if there would be more options expected that I'm not aware of. ...what do you mean by "EXPLAIN"?

Looking over the specs they sent, it's actually not terribly complicated. I'm looking for some reading to familiarize myself with search systems.

Reply With Quote
07-31-2009, 07:42 PM
#4
Refrozen is offline Refrozen
Status: I'm new around here
Join date: Sep 2008
Location:
Expertise:
Software:
 
Posts: 12
iTrader: 0 / 0%
 

Refrozen is on a distinguished road

  Old

A simple search engine can be done with just raw MySQL queries for sure. Should be pretty easy, but if you want something with intelligent ranking I'd look at one of the packaged solutions.

Reply With Quote
08-03-2009, 11:41 AM
#5
premiumscripts is offline premiumscripts
Status: I'm new around here
Join date: Aug 2009
Location:
Expertise:
Software:
 
Posts: 8
iTrader: 0 / 0%
 

premiumscripts is on a distinguished road

  Old

If it's a high traffic site you may want to look at http://www.sphinxsearch.com/ which is an open source SQL full text search engine much faster than mysql's built in functionality. However, this is only necessary if the website is getting tens of thousands of searches per day.

Anyway, here's a good tutorial on how to do mysql fulltext search: http://devzone.zend.com/article/1304 - It shows you how to do boolean searches like you want.

Reply With Quote
08-04-2009, 08:58 AM
#6
Trustmaster is offline Trustmaster
Status: I'm new around here
Join date: Aug 2009
Location: Russian Federation
Expertise:
Software:
 
Posts: 5
iTrader: 0 / 0%
 

Trustmaster is on a distinguished road

  Old

If the site is not very popular, then simple queries with LIKE would do the job best. Just write a simple search query parser which would allow users to apply AND, OR and wildcards to it.

MySQL FULLTEXT is for MyISAM tables only and has some other limitations. And it has poor performance. Just an example benchmark. So if you're running a busy site and have a VPS or a Dedicated server, then Sphinx is the best option.

Summary: PHP+LIKE for small sites, Sphinx for big sites and FULLTEXT for intermediate sites with MyISAM tables which have not been filled with much data yet.

Reply With Quote
08-07-2009, 05:05 PM
#7
insub2 is offline insub2
Status: Member
Join date: Jun 2007
Location:
Expertise:
Software:
 
Posts: 136
iTrader: 1 / 100%
 

insub2 is on a distinguished road

Send a message via AIM to insub2

  Old

Thanks! That was pretty much exactly what I was looking for. And now I have a better idea of what to search for. Awesome.

Reply With Quote
Reply    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed