Search code examples
angularjssolrsolr-boost

how to get apply boost in solr based on condition


I am new to solr and i have 2 fields say displayName and foodType in my solr currently i am querying from angular using the following code

angular.element.ajax({
                url: "http://dev2.slim.in:8983/solr/food/select",
                data: {
                    "q": "displayName",
                    "wt": "json",
                    "start":0,
                    "rows":200

                },
                traditional: true,
                cache: true,
                async: true,
                dataType: 'jsonp',
                success: function (data) {
                    //and when we get the query back we
                    //stick the results in the scope
                    $scope.$apply(function () {
                        $scope.foodResults = data.response.docs;
                        console.log("result from solr is  ",$scope.foodResults)

                    });
                },
                jsonp: 'json.wrf'
            });

If the displayName matched with the query has the field foodType as indian then i want to boost it higher than other docs how to do it ???


Solution

  • Use a bq or boost with the (e)dismax query parser.

    bq=foodType:indian^3