comparison doc/design.txt @ 5867:ee2e8f8d6648

Implement exact string search .. in the 'filter' method of hyperdb.Class (and the corresponding backend implementations).
author Ralf Schlatterbeck <rsc@runtux.com>
date Mon, 26 Aug 2019 18:18:02 +0200
parents d0689aaa83db
children 16e1255b16cf
comparison
equal deleted inserted replaced
5865:04deafac71ab 5867:ee2e8f8d6648
513 513
514 db.issue.find(messages='1') 514 db.issue.find(messages='1')
515 db.issue.find(messages={'1':1,'3':1}, files={'7':1}) 515 db.issue.find(messages={'1':1,'3':1}, files={'7':1})
516 """ 516 """
517 517
518 def filter(self, search_matches, filterspec, sort, group): 518 def filter(self, search_matches, filterspec, sort, group,
519 retired, exact_match_spec):
519 """Return a list of the ids of the active nodes in this class that 520 """Return a list of the ids of the active nodes in this class that
520 match the 'filter' spec, sorted by the group spec and then the 521 match the 'filter' spec, sorted by the group spec and then the
521 sort spec. 522 sort spec. The arguments sort, group, retired, and
522 523 exact_match_spec are optional.
523 "search_matches" is a container type 524
525 "search_matches" is a container type which by default is
526 None and optionally contains IDs of items to match. If
527 non-empty only IDs of the initial set are returned.
524 528
525 "filterspec" is {propname: value(s)} 529 "filterspec" is {propname: value(s)}
530 "exact_match_spec" is the same format as "filterspec" but
531 specifies exact match for the given propnames. This only
532 makes a difference for String properties, these specify case
533 insensitive substring search when in "filterspec" and exact
534 match when in exact_match_spec.
526 535
527 "sort" and "group" are [(dir, prop), ...] where dir is '+', '-' 536 "sort" and "group" are [(dir, prop), ...] where dir is '+', '-'
528 or None and prop is a prop name or None. Note that for 537 or None and prop is a prop name or None. Note that for
529 backward-compatibility reasons a single (dir, prop) tuple is 538 backward-compatibility reasons a single (dir, prop) tuple is
530 also allowed. 539 also allowed.
531 540
541 The parameter retired when set to False, returns only live
542 (un-retired) results. When setting it to True, only retired
543 items are returned. If None, both retired and unretired
544 items are returned. The default is False, i.e. only live
545 items are returned by default.
546
532 The filter must match all properties specificed. If the property 547 The filter must match all properties specificed. If the property
533 value to match is a list: 548 value to match is a list:
534 549
535 1. String properties must match all elements in the list, and 550 1. String properties must match all elements in the list, and
536 2. Other properties must match any of the elements in the list. 551 2. Other properties must match any of the elements in the list.
552
553 This also means that for strings in exact_match_spec it
554 doesn't make sense to specify multiple values because those
555 cannot all be matched.
537 556
538 The propname in filterspec and prop in a sort/group spec may be 557 The propname in filterspec and prop in a sort/group spec may be
539 transitive, i.e., it may contain properties of the form 558 transitive, i.e., it may contain properties of the form
540 link.link.link.name, e.g. you can search for all issues where 559 link.link.link.name, e.g. you can search for all issues where
541 a message was added by a certain user in the last week with a 560 a message was added by a certain user in the last week with a

Roundup Issue Tracker: http://roundup-tracker.org/