Search code examples
c#solrsolrnet

Solr: How to to search special character with priority


I am new to Solr and using it through SolrNet. When i send a search query for c#, it matches 'C,C++' as well.

How can I give the more priority to the results which have exact match 'C#' ? Or please suggest a better solution to handle such special cases in Solr query.


Solution

  • Few things you need to take care of

    1. ensure you escape special chars like +, -, , *
    2. ensure you store them in a field that don't have analyzers removing these chars
    3. put a higher field boost for the field used to store these chars as opposed to fully analyzed free text field.