I've got a classifieds website, and customers may for instance look for cars.

When looking for a vehicle, you will find numerous being within their names while you all most likely know. For instance allows say Bmw 330ci (ending beeing 'ci'), but there's also Bmw 330i, or Bmw 330di and so forth.

How do i make SOLR "understand" this, therefore if customers look for 330 SOLR will return results that contains 330ci/330i/330di etc.

Also, it shoul NOT return results if your user particularly inputs Bmw 330ci, it should ONLY return Bmw 330ci and never Bmw 330i/di etc...

I'm a new comer to SOLR, however i am beginning to learn how to get results. Need some assistance with that one though!

How does one did it?

Thanks

Well, it is dependent on several factors but, typically, within the first situation you should use wildcards, e.g.:
q=330*

within the second situation you are able to point straight to the area and do a precise search: <fieldName>:330ci

You'd most likely wish to evaluate the area while using WordDelimiterFilterFactory, established to split on number transitions. That will permit a question of 330 to complement 330anything.

In my opinion that, automatically, whenever you also do that at query time, it'll produce a phrase query from 330di -> "330 di", that ought to only match if both parts can be found within the index. See http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters for additional particulars.

I'm not sure SOLR, it appear to become for full-text search.

However, since you know your model upfront, you could utilize regular SQL to get this done.


Within the database area for title, rather than mixing the bottom title using the ending, you are able to split the 2 in 2 posts, like "rootName" and "suffixName".

Your SQL can very naturally, and very effectively (in comparison to full-text search), find the thing you need : look for the "rootName", as well as choose around the "suffixName" (but only when specified).