views:

381

answers:

4

I'm going to make a small site which requires advanced search capabilities. Since reinventing the wheel isn't such a worthwhile activity, I've done a little googling and found there are some PHP based search frameworks, one of which is integrated into Zend framework.

What I would like to have in the framework:

  1. Both full-text and catalogue search capabilities
  2. Display results sorted by relevance
  3. Ability to filter results by category
  4. Sorting results by various criteria
  5. Fast search
  6. Fast insertion not required

Since the site will feature pretty much static content (some text and a product catalogue), I might go with some pre-generated index.

Are there any (free) frameworks that could meet the above requirements? Suggestions, tips and ideas are more than welcome. It'd be great if you could share your experiences implementing a search system.

+1  A: 

You may want to go with a CMS such as Joomla or Drupal if the site will have static content only. Both have good search systems. However, search really depends on what sort of content you have. If its simply searching the HTML of the page, that's one thing, but searching the database for a particular model # of a product is another, in which case you need a shopping cart/e-commerce system rather than a CMS.

Click Upvote
if you downvote, please explain the reason for it
Click Upvote
Thanks for the answer. Well I'm actually looking for a search system I could integrate into my project, not a complete CMS or e-commerce package.
frgtn
+1  A: 

Have a look at Omega (based on Xapian) - a link to the Xapian project page

You can integrate it cgi-wise. Because it's based on the blindingly fast Xapian it will be one of the fastest options if you set it up correctly. It can do everything you ask for (including relevance for search results, index web server documents (html, pdf, word, excel, sql databases...) do 'stemming' etc...)

Another (also very good option) would off course be Apache Lucene --> it's this one that is included in the Zend framework you referenced ("Zend Search"). It can do all the same tricks, although i personally prefer Xapian.

Edit: be aware that Omega (and Xapian) are GPL whereas Apache Lucene is LGPL if i recall correctly.

ChristopheD
A word of caution - Xapian seems to be GPL-licensed, which means, if you reference to it from your code, your code needs to be GPL too.
Henrik Paul
Thanks for commenting, i'll update the post as this could be very relevant to the question asker.
ChristopheD
If you're looking at Zend_Search_Lucene make sure to get the January issue of php|architect. It includes an article which mentions the common pitfalls of it.
Till
Thanks for both the answer and information about the license. It's going to be a small project so integration via cgi might not go with the hosting company. But Apache Lucene seems a good option with Zend implementation. And thanks, Till, i'll check out the mag.
frgtn
A: 

I recently developed a suggestive fulltext search to use with my Zend Framework based web application - I couldn't find any ready-made solution that fit my requirements, so I went all out and developed a simple(fulltext) keyword search mechanism from scratch. I found the following articles helpful:

http://devzone.zend.com/node/view/id/1304

http://dev.mysql.com/doc/refman/5.1/en/fulltext-search.html

What I have now is a system that matches items based on a 'text summary' that is generated at the time the item is saved (or updated) in the database. I have a table called kw_search_summary that contains the text summary of each item (script generated), its id and its category id. The 'summary' column is a mysql fulltext index, so I simply MATCH() the summary column AGAINST() a given expression, and display the results by relevancy. The code that builds this query looks a bit like this:

    $select = $this->db->select()
                 ->from(array('kwi' => 'kw_search_index'),
                        array('id','prodcatid','itemid','useradid','summary','relevance' => "match(summary) against($safeExp in boolean mode)"))
                 ->where("match(summary) against($safeExp in boolean mode)")
                 ->order('relevance desc')
                 ->limitPage($currentPage,self::RESULTS_PER_PAGE);

Hope that was at least a bit helpful.

karim79
Thanks for the links, I've got them bookmarked :)
frgtn
+1  A: 

definitely use SOLR. Solr uses lucene. this can we useful for a medium/big site....

the good thing is you can request result in php serialized format from solr...

EDIT:

this is what you are looking for, I complete forgot about it: Lucene Port To PHP by Zend

Gabriel Sosa
Thanks, I'll keep it in mind for larger projects.
frgtn
look my edit. regards
Gabriel Sosa