Copied to clipboard

Flag this post as spam?

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


  • Karthik 12 posts 92 karma points
    Jul 03, 2020 @ 14:16
    Karthik
    0

    Getting maxClauseCount is set to 1024 Error for Umbraco.ContentQuery.Search(@text, null)

    Hi Team,

    I'm getting below issue while using Umbraco.ContentQuery.Search(@query, null).

    Please suggest how to resolve.

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Jul 03, 2020 @ 14:57
    Ismail Mayat
    100

    The umbraco search uses examine which in turn uses lucene.

    The Search method in Umbraco.ContentQuery will create a query over all the fields in the index, those fields are based on all fields in all document types.

    If you have alot of doctypes and fields then that list will get pretty big

    When creating lucene queries there is limit on number of clauses in a query. So in your case it looks like its reaching that limit.

    This can be changed but it requires code todo it. However probably better round this is instead of using Umbraco.ContentQuery.Search create your own examine query and give the fields you want to search over. This will give you less clauses and thus you will not hit that limit.

    True story I broke our.umbraco about 2 years by submitting a PR to examine where it by passed max clause count that PR had to be reverted as our umbraco started giving this same error.

    Regards

    Ismail

  • LandLogic IT 6 posts 27 karma points
    May 13, 2024 @ 18:51
    LandLogic IT
    0

    Solution for Umbraco 12+: @using Lucene.Net.Search

    @{

    BooleanQuery.MaxClauseCount = Int32.MaxValue;
    

    }

Please Sign in or register to post replies

Write your reply to:

Draft