Page MenuHomePhabricator

Add ability to refine search queries to comments made by a particular user
Open, Needs TriagePublicFeature

Description

User story: As an editor interested in referencing a specific past comment made by myself or another user, I want to be able to refine a search query to return results only from comments made by that user.

More specific version: I often encounter a topic in a discussion that I have a point of view about and have commented on in the past. I want to find that comment so that I can link to it or reiterate my comment without having to totally rewrite it. However, I don't remember where I made it. So I'm left trying to search for precise enough keywords to find my past comment in the sea of all comments ever written. This would be a lot easier if I could refine a search to include only my own past comments.

Event Timeline

Shivang9856 subscribed.

I’d like to work on this task.

My planned implementation steps are:

  1. Use DiscussionTools’ comment parser to extract each comment’s body text and author.
  2. Add the relevant comment author/text data to the search index through MediaWiki’s search-indexing hook.
  3. Extend the CirrusSearch mapping to support the new comment-related indexed fields.
  4. Add a new search keyword/filter for refining results by comment author.
  5. Ensure the query matches the comment text and author together, so comments from other users are not returned incorrectly.
  6. Add/update unit tests for comment indexing and the new search syntax.

I’ll first verify the existing indexing and query architecture, then implement and test the changes.

Hi, I’ve finished working on T437754 and submitted the changes to Gerrit for review.

Gerrit Change: 1340539

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CirrusSearch/+/1340539

The patch adds comment author/text indexing, the commentby: search option, same-comment matching for the author and text, and the related unit tests. It’s now up for CI and review.

@Shivang9856 Thanks for the patch. Please follow https://www.mediawiki.org/wiki/Gerrit/Commit_message_guidelines and correct your commit message. After that, no manually added comments on tasks about Gerrit patches will be needed anymore.

dcausse subscribed.

Adding DiscussionTools, my understanding is that this data is "owned" by this extension and thus should also own the search logic behind it.
There should be some estimate about the expected volume and cost before moving forward.

Following-up here based on discussions on https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CirrusSearch/+/1340539.
General guidelines:

  • CirrusSearch should not depend on DiscussiontTools, since the data is "owned" by DiscussiontTools the mapping, the SearchDataForIndex2 hook and the search keyword implementation should be added to DiscussiontTools. This means that DiscussionTools will depend on CirrusSearch and probably something that needs agreement from the DiscussionTools maintainers.
  • nested fields should be avoided, I understand the need for nested field if we want to perfectly match the comment text and its author but given the ticket description I am not clear if this is a strong requirement, for instance would filtering by author be already sufficient to narrow down the search space? Specific examples would greatly help I think here. If there are possible workarounds we should probably explore them first.

Cost:

  • size: if ultimately splitting the comments and attaching them to their author is a necessity we have to estimate the added cost on the search index. Search index documents already contain two copies of the text (the wikitext + the parsed text), this would add a third copy of the text for all discussion pages where DiscussionTools is installed.
  • compute: extracting this information will require calling DiscussionTools on every talk page update. The search index is updated from 3 different sources: page edits, page rerenders, and consistency checks, we have to estimate the update rate on discussion pages and verify that the added cost of calling the DiscussionTools parser is acceptable for the WMF mediawiki cluster.