Ticket #260: scriptindex.diff
File scriptindex.diff, 1.5 KB (added by , 17 years ago) |
---|
-
scriptindex.cc
28 28 #include <algorithm> 29 29 #include <fstream> 30 30 #include <iostream> 31 #include <sstream> 31 32 #include <list> 32 33 #include <map> 33 34 #include <string> … … 95 96 const char * action_names[] = { 96 97 "bad", "new", 97 98 "boolean", "date", "field", "hash", "index", "indexnopos", "load", "lower", 98 " truncate", "unhtml", "unique", "value", "weight"99 "numeric", "truncate", "unhtml", "unique", "value", "weight" 99 100 }; 100 101 101 102 // For debugging: … … 106 107 typedef enum { 107 108 BAD, NEW, 108 109 BOOLEAN, DATE, FIELD, HASH, INDEX, INDEXNOPOS, LOAD, LOWER, 109 TRUNCATE, UNHTML, UNIQUE, VALUE, WEIGHT110 NUMERIC, TRUNCATE, UNHTML, UNIQUE, VALUE, WEIGHT 110 111 } type; 111 112 private: 112 113 type action; … … 233 234 code = Action::LOAD; 234 235 } 235 236 break; 237 case 'n': 238 if (action == "numeric") { 239 code = Action::NUMERIC; 240 arg = YES; 241 takes_integer_argument = true; 242 } 243 break; 236 244 case 't': 237 245 if (action == "truncate") { 238 246 code = Action::TRUNCATE; … … 591 599 if (!value.empty()) 592 600 doc.add_value(i->get_num_arg(), value); 593 601 break; 602 case Action::NUMERIC: 603 if (!value.empty()) 604 { 605 std::istringstream to_double(value); 606 double value_double; 607 608 to_double >> value_double; 609 610 doc.add_value(i->get_num_arg(), Xapian::sortable_serialise(value_double)); 611 } 612 break; 594 613 case Action::DATE: { 595 614 const string & type = i->get_string_arg(); 596 615 string yyyymmdd;