Question

hi Please tell me how to apply multiple valued sort order in solr here is my code given below, I am using solr net for this.

private QueryOptions ConstructQueryOperation(SearchCriteria searchCriteria)
    {
        QueryOptions queryOption =new QueryOptions();

        queryOption.Rows = searchCriteria.Pagination.PageSize;

        queryOption.Start = ((searchCriteria.Pagination.CurrentPage+1) - 1) * searchCriteria.Pagination.PageSize;

        if (searchCriteria.SortCriteria != null)
        {
            foreach (var sortItem in searchCriteria.SortCriteria)
            {
                if (sortItem.Value.ToString() == ListSorter.SortingOrder.Descending.ToString())
                {
                    queryOption.AddOrder(new SolrNet.SortOrder(sortItem.Key, Order.DESC));
                }
                else
                {
                    queryOption.AddOrder(new SolrNet.SortOrder(sortItem.Key, Order.ASC));
                }
            }

        }
        return queryOption;

    }

I am getting a bad server request. Can anyone let me know what needs to be done exactly.

Was it helpful?

Solution

It was a field name mismatch. .Net code was referring to a field that didn't exist in the Solr schema.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top