Skip to content

Commit

Permalink
fixed label filter (#2978)
Browse files Browse the repository at this point in the history
* added old error handling to comment fetching

* Not

* properly escaped cql labels

* reverted changes
  • Loading branch information
hagen-danswer authored Oct 29, 2024
1 parent 75dd103 commit cc40f0d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions backend/danswer/connectors/confluence/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,13 @@ def __init__(
cql_page_query += f" and id='{page_id}'"

self.cql_page_query = cql_page_query
self.cql_label_filter = ""
self.cql_time_filter = ""

self.cql_label_filter = ""
if labels_to_skip:
labels_to_skip = list(set(labels_to_skip))
comma_separated_labels = ",".join(labels_to_skip)
self.cql_label_filter = f"&label not in ({comma_separated_labels})"
comma_separated_labels = ",".join(f"'{label}'" for label in labels_to_skip)
self.cql_label_filter = f" and label not in ({comma_separated_labels})"

def load_credentials(self, credentials: dict[str, Any]) -> dict[str, Any] | None:
# see https://github.com/atlassian-api/atlassian-python-api/blob/master/atlassian/rest_client.py
Expand Down Expand Up @@ -125,7 +126,8 @@ def _get_comment_string_for_page_id(self, page_id: str) -> str:
for comment in comments:
comment_string += "\nComment:\n"
comment_string += extract_text_from_confluence_html(
confluence_client=self.confluence_client, confluence_object=comment
confluence_client=self.confluence_client,
confluence_object=comment,
)

return comment_string
Expand Down

0 comments on commit cc40f0d

Please sign in to comment.