Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is great. For a prepackaged implementation that works with any language with a Sphinx API check out misc/suggest in the sphinx tarball.

http://sphinxsearch.com/downloads/release/

It also lets you feed in your own dictionary from your index and works great for spelling suggestions. I haven't benchmarked it but it seems extremely fast - as sphinx is with most things.

Here's the suggest text file from the sphinx 0.9.9 source:

0) What's this. This sample shows how to implement simple keyword correction suggestions (ie. "did you mean") using Sphinx.

1) Requirements. You will need Sphinx, MySQL, and PHP CLI.

2) Quickstart. (Skip first indexer command to use bundled sample.)

indexer YOURINDEX --config YOURCONFIG.CONF --buildstops

dict.txt 100000 --buildfreqs

cat dict.txt | php suggest.php --builddict > dict.sql

mysql -u root test < dict.sql

indexer --config suggest.conf --all

searchd --config suggest.conf

php suggest.php --query sphynx



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: