Skip to content

reopened: #111 Result for semantic search with query "[[HasLabel::BMD_StandardCU_V3]]" delivers random results, but more general #145

Description

@Masltov

Issue persists, when querying via semantic_search(), correct osw_id is either returned or not (empty return).
Reproduced for "Item:OSWb5cbec50fb7c4c65b2082a20c6c32fb8", with "HasLabel::BMD_StandardCU_HealthBatt" and "[[HasUuid::b5cbec50-fb7c-4c65-b208-2a20c6c32fb8]]".

Activity

  1. LukasGold commented on Aug 31, 2026

    @LukasGold
    Contributor

    Reproduced and root-caused against healthbatt.projects01.open-semantic-lab.org. There are two independent things here.

    1. The empty return is a crash, fixed in #150

    SMW's action=ask serialises a non-empty result set as a JSON object keyed by page title, but an empty one as a JSON array:

    [[HasUuid::b5cbec50-fb7c-4c65-b208-2a20c6c32fb8]]  -> "results": []   (list)
    [[HasLabel::BMD_StandardCU_HealthBatt]]            -> "results": {..} (dict)
    

    semantic_search called .values() on that payload unconditionally (https://github.com/OpenSemanticLab/osw-python/blob/main/src/osw/wiki_tools.py#L257), so every zero-result query raised AttributeError: 'list' object has no attribute 'values' instead of returning []. Single queries, sequential batches and parallel batches are all affected, as is OSW.query_instances(), which raised for any category with no instances.

    return_json=True was unaffected because it returns before that line, which is why the failure looked intermittent depending on how the query was issued.

    2. The two identifiers in the report do not refer to the same page

    Independently of the crash, on the current instance:

    • Item:OSWb5cbec50fb7c4c65b2082a20c6c32fb8 does not exist
    • [[HasLabel::BMD_StandardCU_HealthBatt]] returns exactly one page, Item:OSW0c0600667f8d4fe4a1c919fb8d070c94, stably across 15 consecutive calls

    So [[HasUuid::b5cbec50-...]] legitimately matches nothing, and before the fix that empty match set is exactly what crashed. Worth double-checking whether the expected page was deleted or re-created under a new UUID.

    3. The "random" part is a separate, server-side problem

    See the analysis in #111 - the exists flag flickers between '1' and '' for pages that do exist, and the library's exists == "1" filter silently drops them. That one is not fixable in osw-python; PR #150 only adds a warning so the loss is visible.

  2. self-assigned this
    on Sep 2, 2026
  3. LukasGold commented on Sep 2, 2026

    @LukasGold
    Contributor

    @SimonStier Handling this issue surfaced a sever server-side problem, see above

  4. added theissue type on Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions