Take the 2-minute tour ×

I am a bit confused as to where SOLR usage ends and where it begins.

I use php with a relational mysql db for a shopping site where all tables are related to the product table joining the tables as theyre queried. Needless to say its too slow!


  • Category table - catid, catname, catdesc
  • Brand table - brandid, brandname, branddesc
  • Product table - productid, productname, productdesc, catid, brandid
  • (I also use ranges for price ranges etc)

I am wondering whether I should use SOLR to index the whole relational schema or whether just to index the product table alone and let my application work as it currently does.

If I just switch the product table to use SOLR are there any caveats to this?

e.g. in mysql I can do a fulltext search while joining the brand table. This will allow brands to also be searched upon. Is it possible to achieve the same thing just by switching the product table to SOLR? Are there any other caveats I should be looking out for.

I also would like to create a new table for "searches". This would allow me to use keywords in a mysql table in the following way:

Searches table - searchterm (e.g. lipstick), synonyms (e.g. lipstick, lips etc.)

ie. this would allow me to search upon multiple terms at the same time - a good time to use SOLR facets maybe instead of storing searches in mysql?, or should I just use mysql to store the searches and pull the products from SOLR?

Any help is gladly appreciated

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted


You don't want to "switch" -- just like using full-text indexing in MySQL (or using something like Sphinx), the full-text index is separate from the database tables.

What you want to do is figure out what you're searching for and index that in Solr -- it may well be just products. That's certainly an easy first step.

Basically you'll:

  • index the appropriate column(s) into Solr
  • use Solr for the searching
  • use the Solr results to point back to the records from the database

I'm more Ruby and Java than PHP, but you'll basically be talking to Solr for the full-text search and using that to find the records you want to display.

share|improve this answer
Thanks for such a quick answer, youve made my day :) –  Ke. Feb 3 '10 at 5:38
John is quite right. Also take a look at the /example app shipped with Solr, it may help you think about that specific usecase as it's setup to deal with search for products. –  Eric Pugh Feb 4 '10 at 0:28
add comment

Your Answer


