SOLR - How to handle inner Query
How would we query this clause in the SOLR
and (Jobseeker.eid not in (select eid from jobseeker_emailresume where cid = #usecid# and datesent >= #createodbcdate(emaileddate)# ))
To do it in SOLR i am creating list of inner query result and then i am doing like this
-eid: (5210 OR 5357)
It works PERFECT with small data but for large data it generates Error. Like
-eid: (5210 OR 5357 OR 5405 OR 5408 OR 5492 OR 5575 OR 5700 OR 5817 OR 7179 OR 9054 OR 9358 OR 9947 OR 9948 OR 9953 OR 9999 OR 10086 OR 10290 OR 10430 OR 10492 OR 10835 OR 11022 OR 11144 OR 11250 OR 11289 OR 11417 OR 11459 OR 11571 OR 11885 OR 12033 OR 12322 OR 13130 OR 13511 OR 13712 OR 14237 OR 15103 OR 17193 OR 17929 OR 17930 OR 19110 OR 19111 OR 19979 OR 20165 OR 20182 OR 20653 OR 20754 OR 20813 OR 21878 OR 22049 OR 22057 OR 22262 OR 22298 OR 22506 OR 23372 OR 24114 OR 24617 OR 24897 OR 24986 OR 25252 OR 25842 OR 25924 OR 26202 OR 26225 OR 26230 OR 26937 OR 27239 OR 27511 OR 27903 OR 27904 OR 28113 OR 28153 OR 28280 OR 28342 OR 28459 OR 28611 OR 28635 OR 28726 OR 28806 OR 28842 OR 28852 OR 28921 OR 29033 OR 29034 OR 29313 OR 29415 OR 29502 OR 29742 OR 30633 OR 31149 OR 31406 OR 31545 OR 31653 OR 31822 OR 32585 OR 32678 OR 32784 OR 33239 OR 33291 OR 33778 OR 33875 OR 33966 OR 34153 OR 34249 OR 34549 OR 34559 OR 34598 OR 34873 OR 35084 OR 35183 OR 35230 OR 35268 OR 37163 OR 37226 OR 37920 OR 38503 OR 39127 OR 39311 OR 39428 OR 39838 OR 39976 OR 39977 OR 40094 OR 40226 OR 40804 OR 41591 OR 41592 OR 41593 OR 42967 OR 42968 OR 42969 OR 42970 OR 43984 OR 44102 OR 44391 OR 44441 OR 44442 OR 44443 OR 44906 OR 46454 OR 47307 OR 47308 OR 50076 OR 50800 OR 52786 OR 52865 OR 54051 OR 54713 OR 54795 OR 55244 OR 55347 OR 57156 OR 57519 OR 57530 OR 57935 OR 58160 OR 58715 OR 59089 OR 62793 OR 65067 OR 66103 OR 66755 OR 66879 OR 66895 OR 67307 OR 67557 OR 67558 OR 67559 OR 67929 OR 68328 OR 69549 OR 69949 OR 69950 OR 70374 OR 70397 OR 71441 OR 71442 OR 72188 OR 72227 OR 72850 OR 73268 OR 73572 OR 73573 OR 73574 OR 75603 OR 76204 OR 77218 OR 77965 OR 78594 OR 81761 OR 81785 OR 81958 OR 82557 OR 83013 OR 83610 OR 83748 OR 83805 OR 84204 OR 84392 OR 85277 OR 85611 OR 85687 OR 85771 OR 85940 OR 86147 OR 86419 OR 86503 OR 86526 OR 86773 OR 86807 OR 86825 OR 87212 OR 87524 OR 87586 OR 87599 OR 87601 OR 87836 OR 87843 OR 87891 OR 88043 OR 88065 OR 88080 OR 88171 OR 88282 OR 88345 OR 88541 OR 88565 OR 88571 OR 88610 OR 88932 OR 88980 OR 88998 OR 89253 OR 89334 OR 89534 OR 89775 OR 89903 OR 90201 OR 90721 OR 90780 OR 90786 OR 90973 OR 91167 OR 91235 OR 91356 OR 91436 OR 91469 OR 92098 OR 92319 OR 92358 OR 92379 OR 92407 OR 92933 OR 92974 OR 93844 OR 93857 OR 93859 OR 94165 OR 94332 OR 94400 OR 94543 OR 94590 OR 94608 OR 94764 OR 95006 OR 95185 OR 95186 OR 95200 OR 95372 OR 95516 OR 95535 OR 95691 OR 95844 OR 95858 OR 95890 OR 96032 OR 96127 OR 96333 OR 96402 OR 96411 OR 96516 OR 96642 OR 96717 OR 96746 OR 98073 OR 98192 OR 100637 OR 100778 OR 100801 OR 101278 OR 102111 OR 102901 OR 105136 OR 105324 OR 105361 OR 105423 OR 105953 OR 106042 OR 106307 OR 107282 OR 107554 OR 107682 OR 107909 OR 109035 OR 109866 OR 110052 OR 110239 OR 110482 OR 110582 OR 110614 OR 110905 OR 110910 OR 110918 OR 110940 OR 110982 OR 111103 OR 111214 OR 111555 OR 111559 OR 111588 OR 111671 OR 111694 OR 111994 OR 开发者_如何学运维112156 OR 112201 OR 112289 OR 112533 OR 112543 OR 112723 OR 112764 OR 112767 OR 112931 OR 113229 OR 113380 OR 113912 OR 114591 OR 116450 OR 116479 OR 116602 OR 116914 OR 117119 OR 117439 OR 117591 OR 118100 OR 118277 OR 119008 OR 119150 OR 119936 OR 119988 OR 120225 OR 120394 OR 121408 OR 121604 OR 121652 OR 122078 OR 122229 OR 122338 OR 122460 OR 122548 OR 122691 OR 122887 OR 122954 OR 123121 OR 123334 OR 123617 OR 123773 OR 124005 OR 124116 OR 124488 OR 125024 OR 125768 OR 126244 OR 126255 OR 126408 OR 127314 OR 127333 OR 127524 OR 127835 OR 129178 OR 129751 OR 129866 OR 130052 OR 131160 OR 131324 OR 132218 OR 132774 OR 132821 OR 133195 OR 134343 OR 134467 OR 134881 OR 134944 OR 135164 OR 135237 OR 135401 OR 135798 OR 135841 OR 136082 OR 136302 OR 136448 OR 136534 OR 137779 OR 137975 OR 139485 OR 139756 OR 140653 OR 140863 OR 141163 OR 141299 OR 141688 OR 141990 OR 142498 OR 142906 OR 142949 OR 143705 OR 143746 OR 143824 OR 143871 OR 145840 OR 146122 OR 146942 OR 147171 OR 147294 OR 147561 OR 148267 OR 148440 OR 148745 OR 148828 OR 148893 OR 149351 OR 149689 OR 150281 OR 150460 OR 151143 OR 151317 OR 151400 OR 152527 OR 153523 OR 153674 OR 153682 OR 154264 OR 154726 OR 155019 OR 155271 OR 156261 OR 156734 OR 157062 OR 157532 OR 157787 OR 157989 OR 159032 OR 160365 OR 160686 OR 161064 OR 161199 OR 162974 OR 162976 OR 163037 OR 163041 OR 163083 OR 164013 OR 164308 OR 165056 OR 166001 OR 167875 OR 168324 OR 168465 OR 168476 OR 168481 OR 168805 OR 168971 OR 169667 OR 169781 OR 169791 OR 169799 OR 169823 OR 169839 OR 169856 OR 169861 OR 169906 OR 170054 OR 171688 OR 171918 OR 173448 OR 173693 OR 174269 OR 174759 OR 174912 OR 175261 OR 175456 OR 176489 OR 176530 OR 176817 OR 177421 OR 177718 OR 178016 OR 178568 OR 178658 OR 178784 OR 179218 OR 179502 OR 180755 OR 181379 OR 181444 OR 182098 OR 182188 OR 182239 OR 182353 OR 182844 OR 182881 OR 183303 OR 183916 OR 183988 OR 184592 OR 184650 OR 184748 OR 184929 OR 185504 OR 187055 OR 187957 OR 188624 OR 188742 OR 190526 OR 190629 OR 191002 OR 191788 OR 192750 OR 192986 OR 195237 OR 196425 OR 196724 OR 196854 OR 197644 OR 198748 OR 198779 OR 198854 OR 199987 OR 200263 OR 201314 OR 201554 OR 202916 OR 203482 OR 203692 OR 204459 OR 206788 OR 206899 OR 207005 OR 208235 OR 208911 OR 209473 OR 209556 OR 210399 OR 211285 OR 212181 OR 213541 OR 213964 OR 214121 OR 216028 OR 216099 OR 216350 OR 216671 OR 216993 OR 217188 OR 217370 OR 217908 OR 218010 OR 219557 OR 219577 OR 220999 OR 221478 OR 222383 OR 222859 OR 224069 OR 224193 OR 227344 OR 227755 OR 229869 OR 230524 OR 232757 OR 280657 OR 280778 OR 281397 OR 281457 OR 281579 OR 281696 OR 281869 OR 282037 OR 282428 OR 282833 OR 282847 OR 282863 OR 283643 OR 283900 OR 286425 OR 286669 OR 290646 OR 290652 OR 291032 OR 291627 OR 291690 OR 291937 OR 291988 OR 292571 OR 292954 OR 293107 OR 293140 OR 293770 OR 300440 OR 300676 OR 364729 OR 396076 OR 399672 OR 401771 OR 404663 OR 407833 OR 408291 OR 408417 OR 409144 OR 409869 OR 409932 OR 409972 OR 413848 OR 417121 OR 417175 OR 417271 OR 417731 OR 420873 OR 421311 OR 423860 OR 427704 OR 429494 OR 431623 OR 434445 OR 434770 OR 435192 OR 435272 OR 435691 OR 435789 OR 435806 OR 439094 OR 440242 OR 440775 OR 442692 OR 444563 OR 446094 OR 446317 OR 446329 OR 446613 OR 448782 OR 449934 OR 450137 OR 450291 OR 451289 OR 451378 OR 451449 OR 451533 OR 451539 OR 453204 OR 454019 OR 454117 OR 454225 OR 454289 OR 454626 OR 454645 OR 455264 OR 455290 OR 456226 OR 458453 OR 460800 OR 469149 OR 471859 OR 472154 OR 472344 OR 472484 OR 478639 OR 478899 OR 479693 OR 481099 OR 482096 OR 482188 OR 482669 OR 482737 OR 483798 OR 483997 OR 484034 OR 484194 OR 484829 OR 485099 OR 486072 OR 486118 OR 486292 OR 486360 OR 491205 OR 491275 OR 491565 OR 491723 OR 491864 OR 492085 OR 492101 OR 492146 OR 492157 OR 492317 OR 492331 OR 493187 OR 493320 OR 493335 OR 493450 OR 493493 OR 494028 OR 494134 OR 494246 OR 494443 OR 494509 OR 495028 OR 496430 OR 496731 OR 496783 OR 497485 OR 497815 OR 498808 OR 500728 OR 500930 OR 501121 OR 501373 OR 501870 OR 502361 OR 502952 OR 503053 OR 503147 OR 503379 OR 503964 OR 504193 OR 504603 OR 505969 OR 506023 OR 507031 OR 507783 OR 507798 OR 508141 OR 508318 OR 509092 OR 509641 OR 510189 OR 510448 OR 510532 OR 510999 OR 511803 OR 511959 OR 512096 OR 512487 OR 513490 OR 514019 OR 514020 OR 514223 OR 514481 OR 514539 OR 515171 OR 515184 OR 515492 OR 515564 OR 515723 OR 515750 OR 516834 OR 517032 OR 517070 OR 517179 OR 517956 OR 517959 OR 518742 OR 519145 OR 519156 OR 519317 OR 519474 OR 519615 OR 519648 OR 521519 OR 521556 OR 524181 OR 524972 OR 525103 OR 525163)
You need to make sure that your inner query does not exceed the maximum number of allowed boolean clauses. This maximum number can be configured in the configuration script.
Without knowing your domain logic a bit better, you may want to try to denormalize the logic in that subquery into your Solr search query. You have a subquery that's testing values that could themselves be indexed into Solr, allowing you to still do the bulk of your querying from Solr, and saving you from having to pass in a huge list of 'approved' IDs.
Solr by default has a limit of 1,024 OR
clauses. If you bump into this limit, you're probably doing something that's not really a good fit for Solr.
精彩评论