Ticket #72: omega-fieldnames.patch
File omega-fieldnames.patch, 1.0 KB (added by , 19 years ago) |
---|
-
query.cc
2014 2014 // Parse document data. 2015 2015 field.clear(); 2016 2016 string::size_type i = 0; 2017 map<string, string>::const_iterator opt = option.lower_bound("fieldnames");2018 if ( opt != option.end() && !opt->second.empty()) {2017 string fieldnames = option["fieldnames"]; 2018 if (!fieldnames.empty()) { 2019 2019 // Each line is a field, with fieldnames taken from corresponding 2020 2020 // entries in the tab-separated list specified by $opt{fieldnames}. 2021 const string & list = opt->second;2022 2021 string::size_type n = 0, n2; 2023 2022 while (true) { 2024 n2 = list.find('\t', n);2023 n2 = fieldnames.find('\t', n); 2025 2024 string::size_type old_i = i; 2026 2025 i = text.find('\n', i); 2027 field[ list.substr(n, n2 - n)] = text.substr(old_i, i - old_i);2026 field[fieldnames.substr(n, n2 - n)] = text.substr(old_i, i - old_i); 2028 2027 if (n2 == string::npos || i == string::npos) break; 2029 2028 ++i; 2030 2029 n = n2 + 1;