Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Andrew Bright 84 posts 244 karma points
    Feb 16, 2017 @ 12:10
    Andrew Bright
    0

    Price range search not working for low values

    I have an issue when trying to search on lower value price range please see code sales works fine its just the lettings properties with lower values dont for some reason?

    Any help appreciated thanks

     var model = new SearchViewModel
            {
                SearchTerms = new Dictionary<string, string>(),
                Location = "" + Request["Location"],//.ToLower(CultureInfo.InvariantCulture),
    
        MinBedrooms = Convert.ToInt32(Request["MinBedrooms"]),
        MinPrice = Convert.ToInt32(Request["MinPrice"]),
        MaxPrice = Convert.ToInt32(Request["MaxPrice"]),
    }
    
     // Perform the search
            var searcher = ExamineManager.Instance.CreateSearchCriteria();
            //var searcher = ExamineManager.Instance.SearchProviderCollection["InternalSearcher"];
            var query = searcher.NodeTypeAlias("umbPropertyDetails");
    
    
        if (model.MinPrice >= 0 && model.MaxPrice > 0)
        {
            if (model.Department == "sales")
            {
                var paddedLower = model.MinPrice.ToString("D6");
                var paddedHigher = model.MaxPrice.ToString("D6");
                query.And().Range("price", paddedLower, paddedHigher, true, true);
            }
            else
            {
                var higher = model.MaxPrice.ToString();
                var lower = model.MinPrice.ToString();
                query.And().Range("rent", lower, higher, true, true);
            }
        }
    
Please Sign in or register to post replies

Write your reply to:

Draft