solr-boost

How to use boosting in solrnet while using default query?


I am using SolrNet to do query on my default search field and not on any specific field. How can I use Boost on a specific field in that case? Below is the code snippet.

List filter = BuildQuerySingleLine(arrParams);

        var customer = solr.Query(parameters.SingleLineSearch, new QueryOptions
        {                
            FilterQueries  = filter,
            SpellCheck = new SpellCheckingParameters { Collate = true },
            OrderBy = new[] { new SortOrder("score", Order.DESC), SortOrder.Parse("score DESC") },
            StartOrCursor = new StartOrCursor.Start(parameters.StartIndex),
            Rows = parameters.NumberOfRows               

        });

Solution

  • At last I found the solution to this problem. For this I have used dismax request handler and passed the qf param value through SOLRNET.

    With this you can pass the dynamic boost value to the SOLR query, on different fields.

    var extraParams = new Dictionary<string, string> { { "qt", "dismax" }, { "qf", "fieldName^1 FieldName^0.6" } };
    
    var customer = solr.Query(parameters.SingleLineSearch, new QueryOptions
    {                
                              
        StartOrCursor = new StartOrCursor.Start(parameters.StartIndex),
        Rows = parameters.NumberOfRows,
        }, 
        ExtraParams = extraParams
    });