[{"data":1,"prerenderedAt":2269},["ShallowReactive",2],{"navigation":3,"\u002Fsearch\u002Foverview":173,"\u002Fsearch\u002Foverview-surround":2264},[4,27,69,103,113,135],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":26},"Getting Started","i-heroicons-star","\u002Fgetting-started","1.getting-started",[10,14,18,22],{"title":11,"path":12,"stem":13},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction",{"title":15,"path":16,"stem":17},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation",{"title":19,"path":20,"stem":21},"Quick start","\u002Fgetting-started\u002Fquick-start","1.getting-started\u002F3.quick-start",{"title":23,"path":24,"stem":25},"Upgrade guide","\u002Fgetting-started\u002Fupgrade-guide","1.getting-started\u002F5.upgrade-guide",false,{"title":28,"icon":29,"path":30,"stem":31,"children":32,"page":26},"Essentials","i-heroicons-shield-check","\u002Fessentials","2.essentials",[33,37,41,45,49,53,57,61,65],{"title":34,"path":35,"stem":36},"Controls","\u002Fessentials\u002Fcontrols","2.essentials\u002F1.controls",{"title":38,"path":39,"stem":40},"Perimeters","\u002Fessentials\u002Fperimeters","2.essentials\u002F2.perimeters",{"title":42,"path":43,"stem":44},"Perimeter classes","\u002Fessentials\u002Fperimeter-classes","2.essentials\u002F3.perimeter-classes",{"title":46,"path":47,"stem":48},"Levels","\u002Fessentials\u002Flevels","2.essentials\u002F4.levels",{"title":50,"path":51,"stem":52},"Boundaries","\u002Fessentials\u002Fboundaries","2.essentials\u002F5.boundaries",{"title":54,"path":55,"stem":56},"Parents","\u002Fessentials\u002Fparents","2.essentials\u002F6.parents",{"title":58,"path":59,"stem":60},"Policies","\u002Fessentials\u002Fpolicies","2.essentials\u002F7.policies",{"title":62,"path":63,"stem":64},"Queries","\u002Fessentials\u002Fqueries","2.essentials\u002F8.queries",{"title":66,"path":67,"stem":68},"Readers","\u002Fessentials\u002Freaders","2.essentials\u002F9.readers",{"title":70,"icon":71,"path":72,"stem":73,"children":74,"page":26},"Search","i-heroicons-magnifying-glass","\u002Fsearch","3.search",[75,79,83,87,91,95,99],{"title":76,"path":77,"stem":78},"Search overview","\u002Fsearch\u002Foverview","3.search\u002F1.overview",{"title":80,"path":81,"stem":82},"Engines","\u002Fsearch\u002Fengines","3.search\u002F2.engines",{"title":84,"path":85,"stem":86},"Keeping the keys fresh","\u002Fsearch\u002Fkeeping-the-keys-fresh","3.search\u002F3.keeping-the-keys-fresh",{"title":88,"path":89,"stem":90},"Exceptions and dates","\u002Fsearch\u002Fexceptions-and-dates","3.search\u002F4.exceptions-and-dates",{"title":92,"path":93,"stem":94},"Searching through a parent","\u002Fsearch\u002Fthrough-a-parent","3.search\u002F5.through-a-parent",{"title":96,"path":97,"stem":98},"Search from the browser","\u002Fsearch\u002Ffrom-the-browser","3.search\u002F6.from-the-browser",{"title":100,"path":101,"stem":102},"Your own search client","\u002Fsearch\u002Fyour-own-client","3.search\u002F7.your-own-client",{"title":104,"icon":105,"path":106,"stem":107,"children":108,"page":26},"Integrations","i-heroicons-puzzle-piece","\u002Fintegrations","4.integrations",[109],{"title":110,"path":111,"stem":112},"laravel-rest-api","\u002Fintegrations\u002Flaravel-rest-api","4.integrations\u002F1.laravel-rest-api",{"title":114,"icon":115,"path":116,"stem":117,"children":118,"page":26},"Testing and Tooling","i-heroicons-wrench-screwdriver","\u002Ftesting-and-tooling","5.testing-and-tooling",[119,123,127,131],{"title":120,"path":121,"stem":122},"Testing","\u002Ftesting-and-tooling\u002Ftesting","5.testing-and-tooling\u002F1.testing",{"title":124,"path":125,"stem":126},"access:check","\u002Ftesting-and-tooling\u002Faccess-check","5.testing-and-tooling\u002F2.access-check",{"title":128,"path":129,"stem":130},"Cache and about","\u002Ftesting-and-tooling\u002Fcache-and-about","5.testing-and-tooling\u002F3.cache-and-about",{"title":132,"path":133,"stem":134},"Generators","\u002Ftesting-and-tooling\u002Fgenerators","5.testing-and-tooling\u002F4.generators",{"title":136,"icon":137,"path":138,"stem":139,"children":140,"page":26},"Digging Deeper","i-heroicons-list-bullet","\u002Fdigging-deeper","6.digging-deeper",[141,145,149,153,157,161,165,169],{"title":142,"path":143,"stem":144},"Abilities","\u002Fdigging-deeper\u002Fabilities","6.digging-deeper\u002F1.abilities",{"title":146,"path":147,"stem":148},"Kept decisions","\u002Fdigging-deeper\u002Fdecisions","6.digging-deeper\u002F2.decisions",{"title":150,"path":151,"stem":152},"Batched decisions","\u002Fdigging-deeper\u002Fbatched-decisions","6.digging-deeper\u002F3.batched-decisions",{"title":154,"path":155,"stem":156},"Row checks","\u002Fdigging-deeper\u002Frow-checks","6.digging-deeper\u002F4.row-checks",{"title":158,"path":159,"stem":160},"Several brands","\u002Fdigging-deeper\u002Fseveral-brands","6.digging-deeper\u002F5.several-brands",{"title":162,"path":163,"stem":164},"Row context","\u002Fdigging-deeper\u002Frow-context","6.digging-deeper\u002F6.row-context",{"title":166,"path":167,"stem":168},"What is public in 1.x","\u002Fdigging-deeper\u002Fpublic-api","6.digging-deeper\u002F7.public-api",{"title":170,"path":171,"stem":172},"Use with AI","\u002Fdigging-deeper\u002Fuse-with-ai","6.digging-deeper\u002F8.use-with-ai",{"id":174,"title":76,"body":175,"description":2256,"extension":2257,"links":2258,"meta":2259,"navigation":891,"path":77,"seo":2260,"sitemap":2261,"stem":78,"updatedAt":2262,"__hash__":2263},"docs\u002F3.search\u002F1.overview.md",{"type":176,"value":177,"toc":2244},"minimark",[178,834,930,973,982,1009,1022,1027,1045,1056,1127,1140,1144,1151,1246,1306,1311,1319,1437,1448,1452,1466,1622,1645,1649,1678,1682,1694,1905,1934,1938,1941,1981,1990,2008,2012,2018,2156,2210,2217,2221,2240],[179,180,186],"pre",{"className":181,"code":182,"filename":183,"language":184,"meta":185,"style":185},"language-php shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","protected function perimeters(): array\n{\n    return [\n        Levels::of(\n            GlobalPerimeter::new()\n                ->allowed(fn (User $user, Ability $ability) => $user->can(\"{$ability} all posts\"))\n                ->unrestricted(),\n            ClientPerimeter::new()\n                ->allowed(fn (User $user, Ability $ability) => $user->client_id !== null && $user->can(\"{$ability} client posts\"))\n                ->query(fn (Builder $query, User $user) => $query->where('client_id', $user->client_id))\n                ->searchKeys(\n                    name: 'client',\n                    row: fn (Post $post) => $post->client_id,\n                    reader: fn (User $user) => $user->client_id,\n                ),\n            OwnPerimeter::new()\n                ->allowed(fn (User $user, Ability $ability) => $user->can(\"{$ability} own posts\"))\n                ->query(fn (Builder $query, User $user) => $query->where('author_id', $user->id))\n                ->searchKeys(\n                    name: 'author',\n                    row: fn (Post $post) => $post->author_id,\n                    reader: fn (User $user) => $user->id,\n                ),\n        ),\n    ];\n}\n","app\u002FAccess\u002FControls\u002FPostControl.php","php","",[187,188,189,213,219,229,245,259,334,345,357,429,494,504,524,559,591,597,609,663,724,733,749,780,811,816,822,828],"code",{"__ignoreMap":185},[190,191,194,198,201,205,209],"span",{"class":192,"line":193},"line",1,[190,195,197],{"class":196},"spNyl","protected",[190,199,200],{"class":196}," function",[190,202,204],{"class":203},"s2Zo4"," perimeters",[190,206,208],{"class":207},"sMK4o","():",[190,210,212],{"class":211},"sbssI"," array\n",[190,214,216],{"class":192,"line":215},2,[190,217,218],{"class":207},"{\n",[190,220,222,226],{"class":192,"line":221},3,[190,223,225],{"class":224},"s7zQu","    return",[190,227,228],{"class":207}," [\n",[190,230,232,236,239,242],{"class":192,"line":231},4,[190,233,235],{"class":234},"sBMFI","        Levels",[190,237,238],{"class":207},"::",[190,240,241],{"class":203},"of",[190,243,244],{"class":207},"(\n",[190,246,248,251,253,256],{"class":192,"line":247},5,[190,249,250],{"class":234},"            GlobalPerimeter",[190,252,238],{"class":207},[190,254,255],{"class":203},"new",[190,257,258],{"class":207},"()\n",[190,260,262,265,268,271,274,277,280,283,287,290,293,295,298,301,304,306,308,311,314,316,319,321,324,328,331],{"class":192,"line":261},6,[190,263,264],{"class":207},"                ->",[190,266,267],{"class":203},"allowed",[190,269,270],{"class":207},"(",[190,272,273],{"class":196},"fn",[190,275,276],{"class":207}," (",[190,278,279],{"class":234},"User",[190,281,282],{"class":207}," $",[190,284,286],{"class":285},"sTEyZ","user",[190,288,289],{"class":207},",",[190,291,292],{"class":234}," Ability",[190,294,282],{"class":207},[190,296,297],{"class":285},"ability",[190,299,300],{"class":207},")",[190,302,303],{"class":207}," =>",[190,305,282],{"class":207},[190,307,286],{"class":285},[190,309,310],{"class":207},"->",[190,312,313],{"class":203},"can",[190,315,270],{"class":207},[190,317,318],{"class":207},"\"{$",[190,320,297],{"class":285},[190,322,323],{"class":207},"}",[190,325,327],{"class":326},"sfazB"," all posts",[190,329,330],{"class":207},"\"",[190,332,333],{"class":207},"))\n",[190,335,337,339,342],{"class":192,"line":336},7,[190,338,264],{"class":207},[190,340,341],{"class":203},"unrestricted",[190,343,344],{"class":207},"(),\n",[190,346,348,351,353,355],{"class":192,"line":347},8,[190,349,350],{"class":234},"            ClientPerimeter",[190,352,238],{"class":207},[190,354,255],{"class":203},[190,356,258],{"class":207},[190,358,360,362,364,366,368,370,372,374,376,378,380,382,384,386,388,390,392,394,397,400,403,406,408,410,412,414,416,418,420,422,425,427],{"class":192,"line":359},9,[190,361,264],{"class":207},[190,363,267],{"class":203},[190,365,270],{"class":207},[190,367,273],{"class":196},[190,369,276],{"class":207},[190,371,279],{"class":234},[190,373,282],{"class":207},[190,375,286],{"class":285},[190,377,289],{"class":207},[190,379,292],{"class":234},[190,381,282],{"class":207},[190,383,297],{"class":285},[190,385,300],{"class":207},[190,387,303],{"class":207},[190,389,282],{"class":207},[190,391,286],{"class":285},[190,393,310],{"class":207},[190,395,396],{"class":285},"client_id ",[190,398,399],{"class":207},"!==",[190,401,402],{"class":207}," null",[190,404,405],{"class":207}," &&",[190,407,282],{"class":207},[190,409,286],{"class":285},[190,411,310],{"class":207},[190,413,313],{"class":203},[190,415,270],{"class":207},[190,417,318],{"class":207},[190,419,297],{"class":285},[190,421,323],{"class":207},[190,423,424],{"class":326}," client posts",[190,426,330],{"class":207},[190,428,333],{"class":207},[190,430,432,434,437,439,441,443,446,448,450,452,455,457,459,461,463,465,467,469,472,474,477,480,482,484,486,488,490,492],{"class":192,"line":431},10,[190,433,264],{"class":207},[190,435,436],{"class":203},"query",[190,438,270],{"class":207},[190,440,273],{"class":196},[190,442,276],{"class":207},[190,444,445],{"class":234},"Builder",[190,447,282],{"class":207},[190,449,436],{"class":285},[190,451,289],{"class":207},[190,453,454],{"class":234}," User",[190,456,282],{"class":207},[190,458,286],{"class":285},[190,460,300],{"class":207},[190,462,303],{"class":207},[190,464,282],{"class":207},[190,466,436],{"class":285},[190,468,310],{"class":207},[190,470,471],{"class":203},"where",[190,473,270],{"class":207},[190,475,476],{"class":207},"'",[190,478,479],{"class":326},"client_id",[190,481,476],{"class":207},[190,483,289],{"class":207},[190,485,282],{"class":207},[190,487,286],{"class":285},[190,489,310],{"class":207},[190,491,479],{"class":285},[190,493,333],{"class":207},[190,495,497,499,502],{"class":192,"line":496},11,[190,498,264],{"class":207},[190,500,501],{"class":203},"searchKeys",[190,503,244],{"class":207},[190,505,507,510,513,516,519,521],{"class":192,"line":506},12,[190,508,509],{"class":234},"                    name",[190,511,512],{"class":207},":",[190,514,515],{"class":207}," '",[190,517,518],{"class":326},"client",[190,520,476],{"class":207},[190,522,523],{"class":207},",\n",[190,525,527,530,532,535,537,540,542,545,547,549,551,553,555,557],{"class":192,"line":526},13,[190,528,529],{"class":234},"                    row",[190,531,512],{"class":207},[190,533,534],{"class":196}," fn",[190,536,276],{"class":207},[190,538,539],{"class":234},"Post",[190,541,282],{"class":207},[190,543,544],{"class":285},"post",[190,546,300],{"class":207},[190,548,303],{"class":207},[190,550,282],{"class":207},[190,552,544],{"class":285},[190,554,310],{"class":207},[190,556,479],{"class":285},[190,558,523],{"class":207},[190,560,562,565,567,569,571,573,575,577,579,581,583,585,587,589],{"class":192,"line":561},14,[190,563,564],{"class":234},"                    reader",[190,566,512],{"class":207},[190,568,534],{"class":196},[190,570,276],{"class":207},[190,572,279],{"class":234},[190,574,282],{"class":207},[190,576,286],{"class":285},[190,578,300],{"class":207},[190,580,303],{"class":207},[190,582,282],{"class":207},[190,584,286],{"class":285},[190,586,310],{"class":207},[190,588,479],{"class":285},[190,590,523],{"class":207},[190,592,594],{"class":192,"line":593},15,[190,595,596],{"class":207},"                ),\n",[190,598,600,603,605,607],{"class":192,"line":599},16,[190,601,602],{"class":234},"            OwnPerimeter",[190,604,238],{"class":207},[190,606,255],{"class":203},[190,608,258],{"class":207},[190,610,612,614,616,618,620,622,624,626,628,630,632,634,636,638,640,642,644,646,648,650,652,654,656,659,661],{"class":192,"line":611},17,[190,613,264],{"class":207},[190,615,267],{"class":203},[190,617,270],{"class":207},[190,619,273],{"class":196},[190,621,276],{"class":207},[190,623,279],{"class":234},[190,625,282],{"class":207},[190,627,286],{"class":285},[190,629,289],{"class":207},[190,631,292],{"class":234},[190,633,282],{"class":207},[190,635,297],{"class":285},[190,637,300],{"class":207},[190,639,303],{"class":207},[190,641,282],{"class":207},[190,643,286],{"class":285},[190,645,310],{"class":207},[190,647,313],{"class":203},[190,649,270],{"class":207},[190,651,318],{"class":207},[190,653,297],{"class":285},[190,655,323],{"class":207},[190,657,658],{"class":326}," own posts",[190,660,330],{"class":207},[190,662,333],{"class":207},[190,664,666,668,670,672,674,676,678,680,682,684,686,688,690,692,694,696,698,700,702,704,706,709,711,713,715,717,719,722],{"class":192,"line":665},18,[190,667,264],{"class":207},[190,669,436],{"class":203},[190,671,270],{"class":207},[190,673,273],{"class":196},[190,675,276],{"class":207},[190,677,445],{"class":234},[190,679,282],{"class":207},[190,681,436],{"class":285},[190,683,289],{"class":207},[190,685,454],{"class":234},[190,687,282],{"class":207},[190,689,286],{"class":285},[190,691,300],{"class":207},[190,693,303],{"class":207},[190,695,282],{"class":207},[190,697,436],{"class":285},[190,699,310],{"class":207},[190,701,471],{"class":203},[190,703,270],{"class":207},[190,705,476],{"class":207},[190,707,708],{"class":326},"author_id",[190,710,476],{"class":207},[190,712,289],{"class":207},[190,714,282],{"class":207},[190,716,286],{"class":285},[190,718,310],{"class":207},[190,720,721],{"class":285},"id",[190,723,333],{"class":207},[190,725,727,729,731],{"class":192,"line":726},19,[190,728,264],{"class":207},[190,730,501],{"class":203},[190,732,244],{"class":207},[190,734,736,738,740,742,745,747],{"class":192,"line":735},20,[190,737,509],{"class":234},[190,739,512],{"class":207},[190,741,515],{"class":207},[190,743,744],{"class":326},"author",[190,746,476],{"class":207},[190,748,523],{"class":207},[190,750,752,754,756,758,760,762,764,766,768,770,772,774,776,778],{"class":192,"line":751},21,[190,753,529],{"class":234},[190,755,512],{"class":207},[190,757,534],{"class":196},[190,759,276],{"class":207},[190,761,539],{"class":234},[190,763,282],{"class":207},[190,765,544],{"class":285},[190,767,300],{"class":207},[190,769,303],{"class":207},[190,771,282],{"class":207},[190,773,544],{"class":285},[190,775,310],{"class":207},[190,777,708],{"class":285},[190,779,523],{"class":207},[190,781,783,785,787,789,791,793,795,797,799,801,803,805,807,809],{"class":192,"line":782},22,[190,784,564],{"class":234},[190,786,512],{"class":207},[190,788,534],{"class":196},[190,790,276],{"class":207},[190,792,279],{"class":234},[190,794,282],{"class":207},[190,796,286],{"class":285},[190,798,300],{"class":207},[190,800,303],{"class":207},[190,802,282],{"class":207},[190,804,286],{"class":285},[190,806,310],{"class":207},[190,808,721],{"class":285},[190,810,523],{"class":207},[190,812,814],{"class":192,"line":813},23,[190,815,596],{"class":207},[190,817,819],{"class":192,"line":818},24,[190,820,821],{"class":207},"        ),\n",[190,823,825],{"class":192,"line":824},25,[190,826,827],{"class":207},"    ];\n",[190,829,831],{"class":192,"line":830},26,[190,832,833],{"class":207},"}\n",[179,835,838],{"className":181,"code":836,"filename":837,"language":184,"meta":185,"style":185},"use Lomkit\\Access\\Controls\\HasControl;\nuse Lomkit\\Access\\Search\\ControlledSearchable;\n\nclass Post extends Model\n{\n    use HasControl, ControlledSearchable;\n}\n","app\u002FModels\u002FPost.php",[187,839,840,866,887,893,907,911,926],{"__ignoreMap":185},[190,841,842,845,848,851,854,856,858,860,863],{"class":192,"line":193},[190,843,844],{"class":211},"use",[190,846,847],{"class":285}," Lomkit",[190,849,850],{"class":207},"\\",[190,852,853],{"class":285},"Access",[190,855,850],{"class":207},[190,857,34],{"class":285},[190,859,850],{"class":207},[190,861,862],{"class":285},"HasControl",[190,864,865],{"class":207},";\n",[190,867,868,870,872,874,876,878,880,882,885],{"class":192,"line":215},[190,869,844],{"class":211},[190,871,847],{"class":285},[190,873,850],{"class":207},[190,875,853],{"class":285},[190,877,850],{"class":207},[190,879,70],{"class":285},[190,881,850],{"class":207},[190,883,884],{"class":285},"ControlledSearchable",[190,886,865],{"class":207},[190,888,889],{"class":192,"line":221},[190,890,892],{"emptyLinePlaceholder":891},true,"\n",[190,894,895,898,901,904],{"class":192,"line":231},[190,896,897],{"class":196},"class",[190,899,900],{"class":234}," Post",[190,902,903],{"class":196}," extends",[190,905,906],{"class":234}," Model\n",[190,908,909],{"class":192,"line":247},[190,910,218],{"class":207},[190,912,913,916,919,921,924],{"class":192,"line":261},[190,914,915],{"class":211},"    use",[190,917,918],{"class":285}," HasControl",[190,920,289],{"class":207},[190,922,923],{"class":285}," ControlledSearchable",[190,925,865],{"class":207},[190,927,928],{"class":192,"line":336},[190,929,833],{"class":207},[179,931,933],{"className":181,"code":932,"language":184,"meta":185,"style":185},"Post::search('budget')->controlled()->paginate(25);\n",[187,934,935],{"__ignoreMap":185},[190,936,937,939,941,944,946,948,951,953,956,959,962,965,967,970],{"class":192,"line":193},[190,938,539],{"class":234},[190,940,238],{"class":207},[190,942,943],{"class":203},"search",[190,945,270],{"class":207},[190,947,476],{"class":207},[190,949,950],{"class":326},"budget",[190,952,476],{"class":207},[190,954,955],{"class":207},")->",[190,957,958],{"class":203},"controlled",[190,960,961],{"class":207},"()->",[190,963,964],{"class":203},"paginate",[190,966,270],{"class":207},[190,968,969],{"class":211},"25",[190,971,972],{"class":207},");\n",[974,975,976,977,981],"p",{},"A controlled search is ",[978,979,980],"strong",{},"one query to the search engine",", with all the filtering inside it:",[983,984,985,997,1006],"ul",{},[986,987,988,989,992,993,996],"li",{},"each document is indexed with the keys that open it: ",[187,990,991],{},"client.7"," and ",[187,994,995],{},"author.42"," for a post of client 7 written by user 42;",[986,998,999,1000,1002,1003,1005],{},"each reader has keys: ",[187,1001,991],{}," for a manager of client 7 who reaches the client level, ",[187,1004,995],{}," for user 42 at the own level;",[986,1007,1008],{},"the search keeps the documents that share at least one key with the reader.",[974,1010,1011,1012,1016,1017,1021],{},"The keys of every perimeter the reader reaches add up, so one filter gives the union of the perimeters, with the ",[1013,1014,1015],"a",{"href":47},"levels"," and the ",[1013,1018,1020],{"href":1019},"#the-boundary","boundary"," applied as in SQL.",[1023,1024,1026],"h2",{"id":1025},"the-model","The model",[974,1028,1029,1030,1032,1033,1036,1037,1040,1041,1044],{},"Use ",[187,1031,884],{}," instead of Scout's ",[187,1034,1035],{},"Searchable",": the trait includes it. ",[187,1038,1039],{},"toSearchableArray()"," does not change: the keys are added to each document as Scout metadata, the way Scout adds ",[187,1042,1043],{},"__soft_deleted",".",[974,1046,1047,1048,1051,1052,1055],{},"A model that overrides ",[187,1049,1050],{},"makeSearchableUsing()"," returns ",[187,1053,1054],{},"$this->withAccessKeys($models)",", or its documents carry no keys and no controlled search finds them:",[179,1057,1059],{"className":181,"code":1058,"language":184,"meta":185,"style":185},"public function makeSearchableUsing(Collection $models): Collection\n{\n    return $this->withAccessKeys($models->load('tags'));\n}\n",[187,1060,1061,1087,1091,1123],{"__ignoreMap":185},[190,1062,1063,1066,1068,1071,1073,1076,1078,1081,1084],{"class":192,"line":193},[190,1064,1065],{"class":196},"public",[190,1067,200],{"class":196},[190,1069,1070],{"class":203}," makeSearchableUsing",[190,1072,270],{"class":207},[190,1074,1075],{"class":234},"Collection",[190,1077,282],{"class":207},[190,1079,1080],{"class":285},"models",[190,1082,1083],{"class":207},"):",[190,1085,1086],{"class":234}," Collection\n",[190,1088,1089],{"class":192,"line":215},[190,1090,218],{"class":207},[190,1092,1093,1095,1098,1101,1104,1106,1108,1111,1113,1115,1118,1120],{"class":192,"line":221},[190,1094,225],{"class":224},[190,1096,1097],{"class":207}," $this->",[190,1099,1100],{"class":203},"withAccessKeys",[190,1102,1103],{"class":207},"($",[190,1105,1080],{"class":285},[190,1107,310],{"class":207},[190,1109,1110],{"class":203},"load",[190,1112,270],{"class":207},[190,1114,476],{"class":207},[190,1116,1117],{"class":326},"tags",[190,1119,476],{"class":207},[190,1121,1122],{"class":207},"));\n",[190,1124,1125],{"class":192,"line":231},[190,1126,833],{"class":207},[974,1128,1129,1130,1133,1134,1136,1137,1044],{},"Calling ",[187,1131,1132],{},"controlled()"," on the search of a model that still uses ",[187,1135,1035],{}," throws ",[187,1138,1139],{},"MissingControlledSearchableException",[1023,1141,1143],{"id":1142},"search-keys","Search keys",[974,1145,1146,1147,1150],{},"Each perimeter that restricts rows declares its keys with ",[187,1148,1149],{},"searchKeys()",", at the end of its chain:",[179,1152,1154],{"className":181,"code":1153,"language":184,"meta":185,"style":185},"->searchKeys(\n    name: 'client',\n    row: fn (Post $post) => $post->client_id,\n    reader: fn (User $user) => $user->client_id,\n)\n",[187,1155,1156,1164,1179,1210,1241],{"__ignoreMap":185},[190,1157,1158,1160,1162],{"class":192,"line":193},[190,1159,310],{"class":207},[190,1161,501],{"class":203},[190,1163,244],{"class":207},[190,1165,1166,1169,1171,1173,1175,1177],{"class":192,"line":215},[190,1167,1168],{"class":234},"    name",[190,1170,512],{"class":207},[190,1172,515],{"class":207},[190,1174,518],{"class":326},[190,1176,476],{"class":207},[190,1178,523],{"class":207},[190,1180,1181,1184,1186,1188,1190,1192,1194,1196,1198,1200,1202,1204,1206,1208],{"class":192,"line":221},[190,1182,1183],{"class":234},"    row",[190,1185,512],{"class":207},[190,1187,534],{"class":196},[190,1189,276],{"class":207},[190,1191,539],{"class":234},[190,1193,282],{"class":207},[190,1195,544],{"class":285},[190,1197,300],{"class":207},[190,1199,303],{"class":207},[190,1201,282],{"class":207},[190,1203,544],{"class":285},[190,1205,310],{"class":207},[190,1207,479],{"class":285},[190,1209,523],{"class":207},[190,1211,1212,1215,1217,1219,1221,1223,1225,1227,1229,1231,1233,1235,1237,1239],{"class":192,"line":231},[190,1213,1214],{"class":234},"    reader",[190,1216,512],{"class":207},[190,1218,534],{"class":196},[190,1220,276],{"class":207},[190,1222,279],{"class":234},[190,1224,282],{"class":207},[190,1226,286],{"class":285},[190,1228,300],{"class":207},[190,1230,303],{"class":207},[190,1232,282],{"class":207},[190,1234,286],{"class":285},[190,1236,310],{"class":207},[190,1238,479],{"class":285},[190,1240,523],{"class":207},[190,1242,1243],{"class":192,"line":247},[190,1244,1245],{"class":207},")\n",[983,1247,1248,1264,1274,1297],{},[986,1249,1250,1253,1254,1256,1257,1260,1261,1044],{},[187,1251,1252],{},"name"," is required: lowercase letters, digits and underscores, unique in the control. Each key is prefixed with it, such as ",[187,1255,991],{},", so two perimeters never open each other's rows. An invalid name throws ",[187,1258,1259],{},"InvalidSearchKeyNameException",", a duplicate ",[187,1262,1263],{},"DuplicateSearchKeyNameException",[986,1265,1266,1269,1270,1273],{},[187,1267,1268],{},"row"," gives the keys of a row, when it is indexed. ",[187,1271,1272],{},"reader"," gives the keys of a reader, at each search.",[986,1275,1276,1277,1280,1281,992,1284,1286,1287,1280,1290,1293,1294,1044],{},"Each side returns a value, a list of values or a list of tuples: ",[187,1278,1279],{},"[3, 7]"," gives ",[187,1282,1283],{},"client.3",[187,1285,991],{},", ",[187,1288,1289],{},"[['fr', 7]]",[187,1291,1292],{},"client.fr.7",". A value is an int, a string or a backed enum; anything else throws ",[187,1295,1296],{},"InvalidSearchKeyValueException",[986,1298,1299,1302,1303,1305],{},[187,1300,1301],{},"null"," gives no key, never a key that matches ",[187,1304,1301],{},". A reader without any key finds nothing.",[1307,1308,1310],"h3",{"id":1309},"relations","Relations",[974,1312,1313,1314,1316,1317,512],{},"A ",[187,1315,1268],{}," callback that reads a relation declares it in ",[187,1318,1110],{},[179,1320,1322],{"className":181,"code":1321,"language":184,"meta":185,"style":185},"->searchKeys(\n    name: 'shared',\n    row: fn (Post $post) => $post->sharedWith->modelKeys(),\n    reader: fn (User $user) => $user->id,\n    load: ['sharedWith:id'],\n)\n",[187,1323,1324,1332,1347,1383,1413,1433],{"__ignoreMap":185},[190,1325,1326,1328,1330],{"class":192,"line":193},[190,1327,310],{"class":207},[190,1329,501],{"class":203},[190,1331,244],{"class":207},[190,1333,1334,1336,1338,1340,1343,1345],{"class":192,"line":215},[190,1335,1168],{"class":234},[190,1337,512],{"class":207},[190,1339,515],{"class":207},[190,1341,1342],{"class":326},"shared",[190,1344,476],{"class":207},[190,1346,523],{"class":207},[190,1348,1349,1351,1353,1355,1357,1359,1361,1363,1365,1367,1369,1371,1373,1376,1378,1381],{"class":192,"line":221},[190,1350,1183],{"class":234},[190,1352,512],{"class":207},[190,1354,534],{"class":196},[190,1356,276],{"class":207},[190,1358,539],{"class":234},[190,1360,282],{"class":207},[190,1362,544],{"class":285},[190,1364,300],{"class":207},[190,1366,303],{"class":207},[190,1368,282],{"class":207},[190,1370,544],{"class":285},[190,1372,310],{"class":207},[190,1374,1375],{"class":285},"sharedWith",[190,1377,310],{"class":207},[190,1379,1380],{"class":203},"modelKeys",[190,1382,344],{"class":207},[190,1384,1385,1387,1389,1391,1393,1395,1397,1399,1401,1403,1405,1407,1409,1411],{"class":192,"line":231},[190,1386,1214],{"class":234},[190,1388,512],{"class":207},[190,1390,534],{"class":196},[190,1392,276],{"class":207},[190,1394,279],{"class":234},[190,1396,282],{"class":207},[190,1398,286],{"class":285},[190,1400,300],{"class":207},[190,1402,303],{"class":207},[190,1404,282],{"class":207},[190,1406,286],{"class":285},[190,1408,310],{"class":207},[190,1410,721],{"class":285},[190,1412,523],{"class":207},[190,1414,1415,1418,1420,1423,1425,1428,1430],{"class":192,"line":247},[190,1416,1417],{"class":234},"    load",[190,1419,512],{"class":207},[190,1421,1422],{"class":207}," [",[190,1424,476],{"class":207},[190,1426,1427],{"class":326},"sharedWith:id",[190,1429,476],{"class":207},[190,1431,1432],{"class":207},"],\n",[190,1434,1435],{"class":192,"line":261},[190,1436,1245],{"class":207},[974,1438,1439,1440,1136,1442,1445,1446,1044],{},"The relations are loaded once per indexed batch, on a copy of the rows, and the keys are computed with lazy loading disabled: a relation read without ",[187,1441,1110],{},[187,1443,1444],{},"UndeclaredSearchKeyRelationException",". When that relation changes, the documents must be indexed again: see ",[1013,1447,84],{"href":85},[1307,1449,1451],{"id":1450},"the-decision-context","The decision context",[974,1453,1454,1455,1457,1458,1461,1462,512],{},"The ",[187,1456,1272],{}," callback may take the ",[187,1459,1460],{},"AccessContext"," as its second parameter, the object that the hooks of a perimeter class receive. A key that depends on the brand of the request reads it from the ",[1013,1463,1465],{"href":1464},"\u002Fessentials\u002Freaders#the-decision-context","decision context",[179,1467,1469],{"className":181,"code":1468,"language":184,"meta":185,"style":185},"use Lomkit\\Access\\AccessContext;\n\n->searchKeys(\n    name: 'author',\n    row: fn (Post $post) => [[$post->brand_id, $post->author_id]],\n    reader: fn (User $user, AccessContext $context) => [[$context->decisionContext()['brand'], $user->id]],\n)\n",[187,1470,1471,1487,1491,1499,1513,1556,1618],{"__ignoreMap":185},[190,1472,1473,1475,1477,1479,1481,1483,1485],{"class":192,"line":193},[190,1474,844],{"class":211},[190,1476,847],{"class":285},[190,1478,850],{"class":207},[190,1480,853],{"class":285},[190,1482,850],{"class":207},[190,1484,1460],{"class":285},[190,1486,865],{"class":207},[190,1488,1489],{"class":192,"line":215},[190,1490,892],{"emptyLinePlaceholder":891},[190,1492,1493,1495,1497],{"class":192,"line":221},[190,1494,310],{"class":207},[190,1496,501],{"class":203},[190,1498,244],{"class":207},[190,1500,1501,1503,1505,1507,1509,1511],{"class":192,"line":231},[190,1502,1168],{"class":234},[190,1504,512],{"class":207},[190,1506,515],{"class":207},[190,1508,744],{"class":326},[190,1510,476],{"class":207},[190,1512,523],{"class":207},[190,1514,1515,1517,1519,1521,1523,1525,1527,1529,1531,1533,1536,1538,1540,1543,1545,1547,1549,1551,1553],{"class":192,"line":247},[190,1516,1183],{"class":234},[190,1518,512],{"class":207},[190,1520,534],{"class":196},[190,1522,276],{"class":207},[190,1524,539],{"class":234},[190,1526,282],{"class":207},[190,1528,544],{"class":285},[190,1530,300],{"class":207},[190,1532,303],{"class":207},[190,1534,1535],{"class":207}," [[$",[190,1537,544],{"class":285},[190,1539,310],{"class":207},[190,1541,1542],{"class":285},"brand_id",[190,1544,289],{"class":207},[190,1546,282],{"class":207},[190,1548,544],{"class":285},[190,1550,310],{"class":207},[190,1552,708],{"class":285},[190,1554,1555],{"class":207},"]],\n",[190,1557,1558,1560,1562,1564,1566,1568,1570,1572,1574,1577,1579,1582,1584,1586,1588,1590,1592,1595,1598,1600,1603,1605,1608,1610,1612,1614,1616],{"class":192,"line":261},[190,1559,1214],{"class":234},[190,1561,512],{"class":207},[190,1563,534],{"class":196},[190,1565,276],{"class":207},[190,1567,279],{"class":234},[190,1569,282],{"class":207},[190,1571,286],{"class":285},[190,1573,289],{"class":207},[190,1575,1576],{"class":234}," AccessContext",[190,1578,282],{"class":207},[190,1580,1581],{"class":285},"context",[190,1583,300],{"class":207},[190,1585,303],{"class":207},[190,1587,1535],{"class":207},[190,1589,1581],{"class":285},[190,1591,310],{"class":207},[190,1593,1594],{"class":203},"decisionContext",[190,1596,1597],{"class":207},"()[",[190,1599,476],{"class":207},[190,1601,1602],{"class":326},"brand",[190,1604,476],{"class":207},[190,1606,1607],{"class":207},"],",[190,1609,282],{"class":207},[190,1611,286],{"class":285},[190,1613,310],{"class":207},[190,1615,721],{"class":285},[190,1617,1555],{"class":207},[190,1619,1620],{"class":192,"line":336},[190,1621,1245],{"class":207},[983,1623,1624,1631,1636],{},[986,1625,1626,1627,1630],{},"The ability of this context is always ",[187,1628,1629],{},"view",": a search finds the rows the reader may view.",[986,1632,1454,1633,1635],{},[187,1634,1268],{}," callback never receives a context, since rows are indexed outside any request. The context part of a row key comes from a column of the row.",[986,1637,1638,1639,1641,1642,1044],{},"A second parameter that cannot receive an ",[187,1640,1460],{},", or a third parameter without a default value, throws ",[187,1643,1644],{},"InvalidSearchKeyReaderException",[1307,1646,1648],{"id":1647},"levels-and-unrestricted-perimeters","Levels and unrestricted perimeters",[983,1650,1651,1658,1668],{},[986,1652,1653,1654,1657],{},"In a ",[187,1655,1656],{},"Levels::of()"," group, only the highest level the reader reaches gives its keys, as in the queries.",[986,1659,1660,1661,1664,1665,1044],{},"An ",[1013,1662,341],{"href":1663},"\u002Fessentials\u002Fperimeters#unrestricted-perimeters"," perimeter gives no key filter: the search keeps every document inside the boundary. It takes no search keys: declaring them throws ",[187,1666,1667],{},"UnrestrictedPerimeterCallbackException",[986,1669,1670,1671,1674,1675,1044],{},"A perimeter that applies to the reader but declares no search keys adds no row to the search, which is then narrower than the query, never wider. ",[187,1672,1673],{},"php artisan access:check"," reports it as ",[187,1676,1677],{},"perimeter_without_search_keys",[1023,1679,1681],{"id":1680},"the-boundary","The boundary",[974,1683,1313,1684,1686,1687,1690,1691,1693],{},[1013,1685,1020],{"href":51}," declared with ",[187,1688,1689],{},"Boundary::where()"," gives its search keys from the same declaration. A boundary class declares them in a ",[187,1692,1149],{}," method:",[179,1695,1698],{"className":181,"code":1696,"filename":1697,"language":184,"meta":185,"style":185},"use Illuminate\\Database\\Eloquent\\Model;\nuse Lomkit\\Access\\Search\\SearchKeys;\n\nclass TenantBoundary extends Boundary\n{\n    protected function searchKeys(): ?SearchKeys\n    {\n        return SearchKeys::of(\n            name: 'tenant',\n            row: fn (Model $row) => $row->tenant_id,\n            reader: fn (User $user) => $user->tenant_id,\n        );\n    }\n\n    \u002F\u002F scope() and includes() as on the Boundaries page\n}\n","app\u002FAccess\u002FBoundaries\u002FTenantBoundary.php",[187,1699,1700,1724,1745,1749,1761,1765,1783,1788,1802,1818,1850,1881,1886,1891,1895,1901],{"__ignoreMap":185},[190,1701,1702,1704,1707,1709,1712,1714,1717,1719,1722],{"class":192,"line":193},[190,1703,844],{"class":211},[190,1705,1706],{"class":285}," Illuminate",[190,1708,850],{"class":207},[190,1710,1711],{"class":285},"Database",[190,1713,850],{"class":207},[190,1715,1716],{"class":285},"Eloquent",[190,1718,850],{"class":207},[190,1720,1721],{"class":285},"Model",[190,1723,865],{"class":207},[190,1725,1726,1728,1730,1732,1734,1736,1738,1740,1743],{"class":192,"line":215},[190,1727,844],{"class":211},[190,1729,847],{"class":285},[190,1731,850],{"class":207},[190,1733,853],{"class":285},[190,1735,850],{"class":207},[190,1737,70],{"class":285},[190,1739,850],{"class":207},[190,1741,1742],{"class":285},"SearchKeys",[190,1744,865],{"class":207},[190,1746,1747],{"class":192,"line":221},[190,1748,892],{"emptyLinePlaceholder":891},[190,1750,1751,1753,1756,1758],{"class":192,"line":231},[190,1752,897],{"class":196},[190,1754,1755],{"class":234}," TenantBoundary",[190,1757,903],{"class":196},[190,1759,1760],{"class":234}," Boundary\n",[190,1762,1763],{"class":192,"line":247},[190,1764,218],{"class":207},[190,1766,1767,1770,1772,1775,1777,1780],{"class":192,"line":261},[190,1768,1769],{"class":196},"    protected",[190,1771,200],{"class":196},[190,1773,1774],{"class":203}," searchKeys",[190,1776,208],{"class":207},[190,1778,1779],{"class":207}," ?",[190,1781,1782],{"class":234},"SearchKeys\n",[190,1784,1785],{"class":192,"line":336},[190,1786,1787],{"class":207},"    {\n",[190,1789,1790,1793,1796,1798,1800],{"class":192,"line":347},[190,1791,1792],{"class":224},"        return",[190,1794,1795],{"class":234}," SearchKeys",[190,1797,238],{"class":207},[190,1799,241],{"class":203},[190,1801,244],{"class":207},[190,1803,1804,1807,1809,1811,1814,1816],{"class":192,"line":359},[190,1805,1806],{"class":234},"            name",[190,1808,512],{"class":207},[190,1810,515],{"class":207},[190,1812,1813],{"class":326},"tenant",[190,1815,476],{"class":207},[190,1817,523],{"class":207},[190,1819,1820,1823,1825,1827,1829,1831,1833,1835,1837,1839,1841,1843,1845,1848],{"class":192,"line":431},[190,1821,1822],{"class":234},"            row",[190,1824,512],{"class":207},[190,1826,534],{"class":196},[190,1828,276],{"class":207},[190,1830,1721],{"class":234},[190,1832,282],{"class":207},[190,1834,1268],{"class":285},[190,1836,300],{"class":207},[190,1838,303],{"class":207},[190,1840,282],{"class":207},[190,1842,1268],{"class":285},[190,1844,310],{"class":207},[190,1846,1847],{"class":285},"tenant_id",[190,1849,523],{"class":207},[190,1851,1852,1855,1857,1859,1861,1863,1865,1867,1869,1871,1873,1875,1877,1879],{"class":192,"line":496},[190,1853,1854],{"class":234},"            reader",[190,1856,512],{"class":207},[190,1858,534],{"class":196},[190,1860,276],{"class":207},[190,1862,279],{"class":234},[190,1864,282],{"class":207},[190,1866,286],{"class":285},[190,1868,300],{"class":207},[190,1870,303],{"class":207},[190,1872,282],{"class":207},[190,1874,286],{"class":285},[190,1876,310],{"class":207},[190,1878,1847],{"class":285},[190,1880,523],{"class":207},[190,1882,1883],{"class":192,"line":506},[190,1884,1885],{"class":207},"        );\n",[190,1887,1888],{"class":192,"line":526},[190,1889,1890],{"class":207},"    }\n",[190,1892,1893],{"class":192,"line":561},[190,1894,892],{"emptyLinePlaceholder":891},[190,1896,1897],{"class":192,"line":593},[190,1898,1900],{"class":1899},"sHwdD","    \u002F\u002F scope() and includes() as on the Boundaries page\n",[190,1902,1903],{"class":192,"line":599},[190,1904,833],{"class":207},[983,1906,1907,1919,1928],{},[986,1908,1454,1909,1911,1912,1915,1916,1918],{},[187,1910,1272],{}," callback of ",[187,1913,1914],{},"SearchKeys::of()"," may take the ",[187,1917,1460],{}," as its second parameter too, so a boundary that reads the brand of the request finds the same rows in SQL and in a search.",[986,1920,1921,1922,1925,1926,1044],{},"A controlled search on an engine that stores documents throws ",[187,1923,1924],{},"UnsearchableBoundaryException"," when the boundary class has no ",[187,1927,1149],{},[986,1929,1930,1931,1933],{},"A reader whose boundary value is ",[187,1932,1301],{}," finds nothing.",[1023,1935,1937],{"id":1936},"the-documents","The documents",[974,1939,1940],{},"Each document carries two more attributes:",[1942,1943,1944,1957],"table",{},[1945,1946,1947],"thead",{},[1948,1949,1950,1954],"tr",{},[1951,1952,1953],"th",{},"Attribute",[1951,1955,1956],{},"Content",[1958,1959,1960,1971],"tbody",{},[1948,1961,1962,1968],{},[1963,1964,1965],"td",{},[187,1966,1967],{},"_access",[1963,1969,1970],{},"the keys of the row for every perimeter that declares search keys",[1948,1972,1973,1978],{},[1963,1974,1975],{},[187,1976,1977],{},"_boundary",[1963,1979,1980],{},"the keys of the row for the boundary",[974,1982,1983,1984,1986,1987,1989],{},"A document is found when it shares a key with the reader in ",[187,1985,1967],{},", unless the reader is unrestricted, and in ",[187,1988,1977],{},", when the control has a boundary.",[974,1991,1992,1993,1996,1997,2000,2001,2007],{},"The engine never receives a key as you declare it: each key leaves the application as a digest of 32 lowercase hexadecimal characters, in the documents, in the filters and in the ",[1013,1994,1995],{"href":97},"browser tokens"," alike, so every engine compares it exactly (see ",[1013,1998,80],{"href":1999},"\u002Fsearch\u002Fengines#why-digests","). The keys stay readable in the application: the failures of ",[1013,2002,2004],{"href":2003},"\u002Ftesting-and-tooling\u002Ftesting#the-search",[187,2005,2006],{},"assertSearchAgrees()"," list them.",[1023,2009,2011],{"id":2010},"searching","Searching",[974,2013,2014,2015,2017],{},"The search of a ",[187,2016,884],{}," model says whether it is controlled:",[179,2019,2021],{"className":181,"code":2020,"language":184,"meta":185,"style":185},"Post::search('budget')->controlled()->paginate(25);   \u002F\u002F the posts the signed-in user may view\nPost::search('budget')->controlledFor($user)->get();   \u002F\u002F for a named reader: jobs, listeners, commands\nPost::search('budget')->uncontrolled()->paginate(25); \u002F\u002F every post, on purpose: back office, exports\nPost::search('budget')->paginate(25);                  \u002F\u002F throws UndeclaredSearchScopeException\n",[187,2022,2023,2057,2093,2127],{"__ignoreMap":185},[190,2024,2025,2027,2029,2031,2033,2035,2037,2039,2041,2043,2045,2047,2049,2051,2054],{"class":192,"line":193},[190,2026,539],{"class":234},[190,2028,238],{"class":207},[190,2030,943],{"class":203},[190,2032,270],{"class":207},[190,2034,476],{"class":207},[190,2036,950],{"class":326},[190,2038,476],{"class":207},[190,2040,955],{"class":207},[190,2042,958],{"class":203},[190,2044,961],{"class":207},[190,2046,964],{"class":203},[190,2048,270],{"class":207},[190,2050,969],{"class":211},[190,2052,2053],{"class":207},");",[190,2055,2056],{"class":1899},"   \u002F\u002F the posts the signed-in user may view\n",[190,2058,2059,2061,2063,2065,2067,2069,2071,2073,2075,2078,2080,2082,2084,2087,2090],{"class":192,"line":215},[190,2060,539],{"class":234},[190,2062,238],{"class":207},[190,2064,943],{"class":203},[190,2066,270],{"class":207},[190,2068,476],{"class":207},[190,2070,950],{"class":326},[190,2072,476],{"class":207},[190,2074,955],{"class":207},[190,2076,2077],{"class":203},"controlledFor",[190,2079,1103],{"class":207},[190,2081,286],{"class":285},[190,2083,955],{"class":207},[190,2085,2086],{"class":203},"get",[190,2088,2089],{"class":207},"();",[190,2091,2092],{"class":1899},"   \u002F\u002F for a named reader: jobs, listeners, commands\n",[190,2094,2095,2097,2099,2101,2103,2105,2107,2109,2111,2114,2116,2118,2120,2122,2124],{"class":192,"line":221},[190,2096,539],{"class":234},[190,2098,238],{"class":207},[190,2100,943],{"class":203},[190,2102,270],{"class":207},[190,2104,476],{"class":207},[190,2106,950],{"class":326},[190,2108,476],{"class":207},[190,2110,955],{"class":207},[190,2112,2113],{"class":203},"uncontrolled",[190,2115,961],{"class":207},[190,2117,964],{"class":203},[190,2119,270],{"class":207},[190,2121,969],{"class":211},[190,2123,2053],{"class":207},[190,2125,2126],{"class":1899}," \u002F\u002F every post, on purpose: back office, exports\n",[190,2128,2129,2131,2133,2135,2137,2139,2141,2143,2145,2147,2149,2151,2153],{"class":192,"line":231},[190,2130,539],{"class":234},[190,2132,238],{"class":207},[190,2134,943],{"class":203},[190,2136,270],{"class":207},[190,2138,476],{"class":207},[190,2140,950],{"class":326},[190,2142,476],{"class":207},[190,2144,955],{"class":207},[190,2146,964],{"class":203},[190,2148,270],{"class":207},[190,2150,969],{"class":211},[190,2152,2053],{"class":207},[190,2154,2155],{"class":1899},"                  \u002F\u002F throws UndeclaredSearchScopeException\n",[983,2157,2158,2177,2184],{},[986,2159,2160,2161,1286,2163,2166,2167,1136,2170,2173,2174,1044],{},"A search that runs without ",[187,2162,1132],{},[187,2164,2165],{},"controlledFor()"," or ",[187,2168,2169],{},"uncontrolled()",[187,2171,2172],{},"UndeclaredSearchScopeException",". Declaring two of them throws ",[187,2175,2176],{},"ConflictingSearchScopeException",[986,2178,2179,2180,2183],{},"Without a signed-in user, with ",[187,2181,2182],{},"controlledFor(null)",", or for a reader that no perimeter allows, a controlled search returns an empty page without calling the engine.",[986,2185,2186,2187,2189,2190,992,2192,2194,2195,2198,2199,1044],{},"A search always finds the rows the reader may ",[978,2188,1629],{},". ",[187,2191,1132],{},[187,2193,2165],{}," take no ability: one given after the reader throws ",[187,2196,2197],{},"UnsearchableAbilityException",". Search, then decide the other abilities on the results with ",[1013,2200,2201,1286,2204,2166,2207],{"href":151},[187,2202,2203],{},"withAbilities()",[187,2205,2206],{},"Access::preload()",[187,2208,2209],{},"reachableKeys()",[974,2211,2212,2213,2216],{},"A search callback, such as ",[187,2214,2215],{},"Post::search('budget', fn ($client, $query, $options) => ...)",", receives the options that hold the access filter: pass them on to the engine, never rebuild them.",[1023,2218,2220],{"id":2219},"next-steps","Next steps",[983,2222,2223,2228,2233],{},[986,2224,2225,2226,1044],{},"Declare the two attributes in the settings of your engine: ",[1013,2227,80],{"href":81},[986,2229,2230,2231,1044],{},"Reindex the documents when the data their keys read changes: ",[1013,2232,84],{"href":85},[986,2234,2235,2236,1044],{},"Prove that the search finds the rows of the query: ",[1013,2237,2238],{"href":2003},[187,2239,2006],{},[2241,2242,2243],"style",{},"html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}",{"title":185,"searchDepth":193,"depth":215,"links":2245},[2246,2247,2252,2253,2254,2255],{"id":1025,"depth":215,"text":1026},{"id":1142,"depth":215,"text":1143,"children":2248},[2249,2250,2251],{"id":1309,"depth":221,"text":1310},{"id":1450,"depth":221,"text":1451},{"id":1647,"depth":221,"text":1648},{"id":1680,"depth":215,"text":1681},{"id":1936,"depth":215,"text":1937},{"id":2010,"depth":215,"text":2011},{"id":2219,"depth":215,"text":2220},"A controlled Laravel Scout search keeps, in one engine query, the documents the reader may view: each document carries the keys that open it.","md",null,{},{"title":76,"description":2256},{"loc":77,"lastmod":2262},"2026-11-21T16:10:34+01:00","gweT-xT1vjbAxdhcdYGz9HXqWCk4hBpBkr91ZhTojWA",[2265,2267],{"title":66,"path":67,"stem":68,"description":2266,"children":-1},"The reader is the model a decision is made for. Learn about readers of several types, the decision context, and the decisions kept for a request.",{"title":80,"path":81,"stem":82,"description":2268,"children":-1},"Declare the access attributes in Meilisearch, Typesense, Algolia or Turbopuffer, use the database engine, and combine your own filters with the access filter.",1795277179750]