I am using Solr-5.0.0 . I am looking in the product_name field. I need to add some rules to get relevant results.
If I'm looking for a word, if an exact match exists, it should be the first. Example: if I search for laptop , it must first return the exact product_name with the laptop.
If I am looking for more than one word, it must obey rule 1. along with the smallest distance between long word names. Example: if I am looking for a dell laptop , it should return the Dell laptop first than the Dell Inspiron laptop.
If I search for words, it should not return results containing the words with or without . Example: in a laptop bag search, he should not give a Dell laptop with a bag or dell laptop without bags.
How can I achieve these rule-based relevant search results during a query?
My application is in java, so a Java response is welcome.
Juhan source share