I've got a cclassifieds website, and customers may for instance look for cars, and specify a cost range, mileage, fueltype, gearbox along with a by hand put query-string when they prefer to put something specific in to the search, ex "bmw m3".

I'm going to move these details to Solr for faster research, and question if I must index or keep fields.

The only real fields where customers can search was really the "headline" and also the "description" from the classified. They are able to however when i mention above, specify cost ranges for instance.

And So I guess the "headline" and "description" fields ought to be indexed right? But if the cost area, and then any other sub-option fields be also indexed?

Inside a MySQL query the query-syntax could be something similar to this, so that you can rival things i am speaking about: (could have errors, didn't remember just how they where written)

  $query="SELECT * FROM cars_category WHERE headline='bmw m3' OR description='bmw m3' AND price BETWEEN 10000 AND 500000 AND fuel='petrol' AND etc etc";

What exactly do you consider, index/store all fields or what?

It is possible to way of identifying things to store and things to index, or both?


PS: Descriptive solutions are appreciated

To be sure with: anything you will search or sort on ought to be indexed.

However searching and sorting typically works more effectively on fields with distinct values (i.e. a Make area, that contains "Acura", "BMW", "Chevrolet", etc.), rather than large free-text fields like Description. You may think about this for better search engine results and performance.

Inside your situation, I would suggest indexing Cost, Fuel, Headline and then any other distinct fields you're looking for.

A catalog on Description are only helpful should you look for Description = "BMW M3". However that search logic will omit results for example "Red-colored BMW M3 with Pirelli tyres". Searching for Description LIKE "%BMW M3%" will need to scan the whole table anyway, so a catalog will not be very helpful.

and question if I must index or store the fields.

My knowledge of Solr is extremely limited, but what confused me after i began was the indexing terminology: inside a database, storing the information and creating/storing a catalog are two separate things and (in most cases, a minimum of) information is saved in 2 separate places, however in Solr, anything you upload to Solr is indexed. Which means you choose which fields you would like Solr to have the ability to search, and also you assign area types and - hey presto - Solr will find data in individuals area with impressive speed. You are able to figure out how different fields are looked (situation sensitive or otherwise, for instance) and you will determine range searches and so on: browse the wiki here and also the query syntax for comprehensive management of these.

Index anything aside from description. Most databases don't use the index whenever you perform a query having a area using "LIKE '%xxx%".