mirror of https://github.com/kiwix/libkiwix.git
+ better able to deal with indexes without article size & wordCount
This commit is contained in:
parent
db145fb4a7
commit
709f32a872
|
@ -160,8 +160,13 @@ namespace kiwix {
|
|||
result["title"] = this->resultOffset->title;
|
||||
result["url"] = this->resultOffset->url;
|
||||
result["snippet"] = this->resultOffset->snippet;
|
||||
result["size"] = this->beautifyInteger(this->resultOffset->size);
|
||||
result["wordCount"] = this->beautifyInteger(this->resultOffset->wordCount);
|
||||
|
||||
if (this->resultOffset->size >= 0)
|
||||
result["size"] = this->beautifyInteger(this->resultOffset->size);
|
||||
|
||||
if (this->resultOffset->wordCount >= 0)
|
||||
result["wordCount"] = this->beautifyInteger(this->resultOffset->wordCount);
|
||||
|
||||
resultsCDT.PushBack(result);
|
||||
this->resultOffset++;
|
||||
}
|
||||
|
|
|
@ -60,8 +60,8 @@ namespace kiwix {
|
|||
result.url = doc.get_data();
|
||||
result.title = doc.get_value(0);
|
||||
result.snippet = doc.get_value(1);
|
||||
result.size = atoi(doc.get_value(2).c_str());
|
||||
result.wordCount = atoi(doc.get_value(3).c_str());
|
||||
result.size = (doc.get_value(2).empty() == true ? -1 : atoi(doc.get_value(2).c_str()));
|
||||
result.wordCount = (doc.get_value(3).empty() == true ? -1 : atoi(doc.get_value(3).c_str()));
|
||||
result.score = i.get_percent();
|
||||
|
||||
this->results.push_back(result);
|
||||
|
|
Loading…
Reference in New Issue