Skip to content

Support negated searches #568

Closed
Closed

Description

@tobixen

The CalDAV-protocol supports negated text matches, but this is not properly implemented in the current search functionality.

This requires some work:

  • In the caldav-server-tester project, it's needed to do some testing to check if the server supports it or not
  • In the icalendar-searcher project, it's needed to implement support for the != operator
  • In search.py, the build_search_xml_query should be fixed to support negated text matches
  • In search.py, we need a workaround for removing the attribute from the search and then do client-side filtering in cases where the server does not support negated text matches.
  • It's needed to add both unit tests and functional tests

Activity

  1. tobixen commented on Dec 5, 2025

    @tobixen
    MemberAuthor

    Claude made an estimate that this task will take 12-16 hours. Let me think a bit:

    • The icaledar-searcher library does not support the != operator yet. Start by adding test code it (trivial, one hour)
    • The icalendar-searcher library has to be fixed to support != (trivial, one hour)
    • Unit tests on the modifications needed in build_search_xml_query. It may be non-trivial making a good test, but it should be easy making a simplified test - and if it's too complicated it may be skipped (one hour)
    • build_search_xml_query in search.py has to be modified to support. This should also be relatively trivial (search for if self._property_operator[property] == "undef" and add the logic in that area). One hour.
    • Does the server supports the logic? A new test case has to be made in the calendar-server-checker. (relatively trivial, should be one hour).
    • Test all the servers we have available for this feature, adjust the compatibility_hints.py. Time-consuming, but trivial. Two hours.
    • Fix functional tests in caldav_client.py. One hour.
    • Fix the CalDAVSearcher to fall back to client side search for servers not supporting negated searches (search.py is already ripe for refactoring #580 needs to be done first) . One hour.
    • Fight with all the servers and bang on things until the test code passes. Slightly non-trivial and time consuming. Two hours.

    That adds up to 10 hours, including the work done on the sub-projects (caldav-server-tester, icalendar-searcher). Possibly less.

  2. added this to the v3.x milestone on Dec 6, 2025
  3. tobixen commented on Oct 20, 2026

    @tobixen
    MemberAuthor

    Disclaimer: AI-generated text below the line, generated by Claude Opus 5.5, from the prompt(s):

    Issue #567 and #568 - and other search-related issues - please check if they are done and can be closed
    Close #568 and update #545


    Done in v3.5.0 (#750, with icalendar-searcher 1.1.0): add_property_filter() accepts != (alias <>), !contains and def. build_search_xml_query() renders !contains as a negated text-match, and != / def as a bare prop-filter.

    search() currently leaves these operators out of the server query and filters client-side (unless post_filter=False), since no server has been probed for negate-condition support yet. A caldav-server-tester probe for that, letting search() send !contains to servers that honour it, is an optimisation, not a missing feature. It is recorded in docs/design/TODO.md.

    Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions