Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8580961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:56:15+00:00 2026-06-11T20:56:15+00:00

I Am using Alex Shybas Advanced DatabaseCrawler and it is working beautifully… almost… I

  • 0

I Am using Alex Shybas Advanced DatabaseCrawler and it is working beautifully… almost…
I Am using for a carsales application in which you can search for a car using the following values

Model
Make
Fuel
Mileage
Price
Year (Registration date)

I have multiple NumericRange queryies:

  1. -1000 – 0 (this is for those dealers, that do not want the price online. They write the price as -1)
  2. bottom to top ie. (10000 – 20000) This is what i want to sort by

The are both in the same NumericRangeSearchParam() see code below.
The problem is with the Sitecore.Search.QueryOccurance.Should as it makes lucene completely disregard the price limit. ie

I’ll try to illustrate below with the prices returned

Bottom limit: 1000
Top limit: 2000

With Should
-1,
500,
1000,
25000

With must
Nothing (as expected)

Should i not be getting only -1 and 1000 with the should occurance?

I Hope one of you can help as this is driving me mad!

Code below:

    public List<SkinnyItem> DoSearch(CarSearchParameters parameters, string sortby, bool reverse, string indexName)
    {
        Database db = Sitecore.Context.Database;
        string  id = db.GetItem(SitecoreHelper.GetBilSalgsItem().Paths.FullPath+"/"+ Helpers.URLEncoder.ToFriendlyUrl(parameters.Make) + (!string.IsNullOrEmpty(parameters.Model) ? "/" + Helpers.URLEncoder.ToFriendlyUrl(parameters.Model) : ""), LanguageManager.GetLanguage("da")).ID.ToString();
        var param = new CombinedSearchParam()
        {
            FullTextQuery = "",
            Language = "da",
            LocationIds = id,
            RelatedIds = "",
            ShowAllVersions = false,
            TemplateIds = ""

        };
        Item settings = Helpers.SitecoreHelper.GetSettings();

        Sitecore.SharedSource.Search.Searcher searcher = new Sitecore.SharedSource.Search.Searcher(indexName);
        var items = new List<SkinnyItem>();

        //Tilføjer felter med værdier -Make -Model -Trim
        var fields = new FieldValueSearchParam();
        fields.Refinements.Add("Make", parameters.Make);
        fields.Occurance = Sitecore.Search.QueryOccurance.Must;

        if(parameters.Model != string.Empty)
            fields.Refinements.Add("Model", parameters.Model);
        if(parameters.Fuel != string.Empty)
            fields.Refinements.Add("Fuel", parameters.Fuel);

        //Tilføjer Numeriske ranges
        var km = new NumericRangeSearchParam();
        km.Ranges.Add(new NumericRangeSearchParam.NumericRangeField("KM", 0, parameters.MaxKM));

        //Angivet som must fordi at den skal være mellem disse værdier
        km.Occurance = Sitecore.Search.QueryOccurance.Must; 

        //Tilføjer 2 Ranges da bilen enten skal være mellem det valge range eller mindre end 0
        var price = new NumericRangeSearchParam();
        price.Ranges.Add(new NumericRangeSearchParam.NumericRangeField("Price", -1000, 0));
        price.Ranges.Add(new NumericRangeSearchParam.NumericRangeField("Price", parameters.StartPrice, parameters.EndPrice));

        //Should da den bare skal være en af dem (Svarer til ||, OR)
        price.Occurance = Sitecore.Search.QueryOccurance.Should;

        //Tilføjer datointervallet
        var dates = new DateRangeSearchParam();
        dates.Ranges.Add(new DateRangeSearchParam.DateRangeField("ModelDate", new DateTime(parameters.StartYear, 1, 1, 0, 0, 0), new DateTime(parameters.EndYear,12, 31, 23, 59, 59)));
        dates.Occurance = Sitecore.Search.QueryOccurance.Must;

        param.DateRanges.Add(dates);
        param.NumericRanges.Add(price);
        param.NumericRanges.Add(km);
        param.FieldValues.Add(fields);

        //Checker om der er angivet sortering
        if (sortby != null)            
            items.AddRange(searcher.GetItems(param, new Sort(new SortField(sortby, reverse))));
        else
            items.AddRange(searcher.GetItems(param));
        return items;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T20:56:16+00:00Added an answer on June 11, 2026 at 8:56 pm

    It seems there is a bug in the way that Sitecore implements Lucene, which is why my query is behaving this way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working through the tutorial by Alex Young on using flash messages
I'm using the very cool django-filter (via: http://github.com/alex/django-filter ) and either can't seem to
I have am using a WPF application which uses BitmapSource but I need to
I'm using Alex Michael's fantastic javascript filtrr library to allow me to manipulate images
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
Using Location.getBearing(); I seem to get randomly changing bearings. Aka, I can turn the
I am using the Syntax Highlighter built with Javascript by Alex Gorbatchev (http://alexgorbatchev.com/SyntaxHighlighter/download/) The
I am developing a website using Codeigniter and MongoDB (Alex Bilbie library). Currently there
Using R, I would like to find out which Samples (S1, S2, S3, S4,
I'm using the Borland (AKA Embarcodegearland) C++Builder 2007 compiler which has a minor bug

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.