File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 15
15
#include < vector>
16
16
17
17
#include " base/logging.h"
18
+ #include " core/search/query_driver.h"
18
19
#include " core/search/search.h"
19
20
#include " core/search/vector_utils.h"
20
21
#include " facade/cmd_arg_parser.h"
@@ -619,9 +620,23 @@ void SearchReply(const SearchParams& params,
619
620
}
620
621
}
621
622
623
+ // Warms up the query parser to avoid first-call slowness
624
+ void WarmupQueryParser () {
625
+ static std::once_flag warmed_up;
626
+ std::call_once (warmed_up, []() {
627
+ search::QueryParams params;
628
+ search::QueryDriver driver{};
629
+ driver.SetParams (¶ms);
630
+ driver.SetInput (std::string{" " });
631
+ (void )search::Parser (&driver)();
632
+ });
633
+ }
634
+
622
635
} // namespace
623
636
624
637
void SearchFamily::FtCreate (CmdArgList args, const CommandContext& cmd_cntx) {
638
+ WarmupQueryParser ();
639
+
625
640
auto * builder = cmd_cntx.rb ;
626
641
if (cmd_cntx.conn_cntx ->conn_state .db_index != 0 ) {
627
642
return builder->SendError (" Cannot create index on db != 0" sv);
You can’t perform that action at this time.
0 commit comments