Skip to content

Commit 38ea7e6

Browse files
committed
chore(search): improve parser error reporting
Also, warn explicitly about lack of scoring support for vector search. Signed-off-by: Roman Gershman <[email protected]>
1 parent e6a9e0d commit 38ea7e6

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

src/core/search/parser.y

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,5 +174,5 @@ tag_list:
174174
void
175175
dfly::search::Parser::error(const location_type& l, const string& m)
176176
{
177-
cerr << l << ": " << m << '\n';
177+
driver->Error(l, m);
178178
}

src/core/search/query_driver.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ void QueryDriver::ResetScanner() {
1818
scanner_->SetParams(params_);
1919
}
2020

21+
void QueryDriver::Error(const Parser::location_type& loc, std::string_view msg) {
22+
LOG(ERROR) << "Parse error " << loc << ": " << msg;
23+
}
24+
2125
} // namespace search
2226

2327
} // namespace dfly

src/core/search/query_driver.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ class QueryDriver {
5252
return scanner_.get();
5353
}
5454

55+
void Error(const Parser::location_type& loc, std::string_view msg);
56+
5557
public:
5658
Parser::location_type location;
5759

src/core/search/search.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,9 @@ void FieldIndices::CreateIndices(PMR_NS::memory_resource* mr) {
488488
vector_index = make_unique<FlatVectorIndex>(vparams, mr);
489489

490490
indices_[field_ident] = std::move(vector_index);
491+
LOG_FIRST_N(WARNING, 1)
492+
<< "Created vector index '" << field_ident
493+
<< "', but the computed score field '__vector_score' is not supported yet";
491494
break;
492495
}
493496
}

0 commit comments

Comments
 (0)