Page MenuHomePhabricator

List number of search results in titles
Open, LowestPublic

Description

https://www.mediawiki.org/w/api.php?action=help&modules=query%2Bsearch

There's are example in the bottom of the page: api.php?action=query&list=search&srwhat=text&srsearch=meaning -- It lists "totalhits" for all entries and and "wordcount" for each entry.

Is there a URI to list the hits for "meaning" for each entry like "wordcount"?

Event Timeline

Hi @David_Hedlund, thanks for taking the time to report this! Unfortunately this report lacks some information.

If you have a question how to use the API, please ask on https://lists.wikimedia.org/mailman/listinfo/mediawiki-api or in a support forum. (Phabricator is for bug reports and feature requests, basically.)

If this is a feature request (asking for functionality that does not exist yet): Please add a more complete description to this report: A clear list of specific steps to reproduce the situation, describing actual results, and describing expected results after performing the steps to reproduce.
You can edit the task description by clicking Edit Task. Thanks!

Title:Text in page

  • Foo: Hello world.
  • Bar: Apples are good
  • Baz: Something in this world that takes you to another world.

URI that lists the word "world":

  • Foo: 1
  • Bar: 0
  • Baz: 2

@Aklapper I tried to describe it better. Do you understand it?

Title:Text in page

  • Foo: Hello world.
  • Bar: Apples are good
  • Baz: Another world, where we all are one.

URI that lists the word "world":

  • Foo: 1
  • Bar: 0
  • Baz: 2

Why is Baz: 2 if "Another world, where we all are one." only includes the word "world" once?
Bar would not be a listed search result anyway, if I understand correctly, as it has 0 matching?

What is the use case? In which situations is it relevant /helpful to know the wordcount in a title?

Again, if your question is "Does XYZ exist?" then that is a support question and out of scope for Phabricator. That seems to be the case here.
If you think that XYZ does not exist then you need to explain why it should exist and rephrase this task to become a feature request. https://mediawiki.org/wiki/How_to_report_a_bug explains how to structure your tasks: Provide steps to reproduce, expected outcome, and actual outcome, in separate sections.

@Aklapper I corrected the example. I think it's an issue if this cannot be listed because it should be possible to count hits in MediaWiki pages. For example curl+jq could be used as a search engine to list them in a terminal.

This works:
search="meaning"; curl "https://www.mediawiki.org/w/api.php?action=query&list=search&srwhat=text&format=json&srsearch=$search" | jq .query.search[].title
search="meaning"; curl "https://www.mediawiki.org/w/api.php?action=query&list=search&srwhat=text&format=json&srsearch=$search" | jq .query.search[].wordcount

Proposed "jq .query.search[].hits" like this:
search="meaning"; curl "https://www.mediawiki.org/w/api.php?action=query&list=search&srwhat=text&format=json&srsearch=$search" | jq .query.search[].hits

I also suggest that results should be displayed next to the titles in MediaWiki's search page. I modified a screenshot to give examples, see "Free software (190 results)", "Free and open-sourde software (116 results)", etc, and the example under "Results from sister projects".

results.png (810×979 px, 183 KB)

JJMC89 renamed this task from heaaaaaaaa to List number of search results in titles.Jul 1 2018, 3:58 AM
JJMC89 raised the priority of this task from High to Needs Triage.
JJMC89 updated the task description. (Show Details)
Anomie subscribed.

Implementing this would require that the SearchResult be able to expose this information and the search engine populate it.

EBjune triaged this task as Lowest priority.Jul 5 2018, 5:14 PM
EBjune subscribed.

We're not sure how this kind of feature would be useful, as frequency already bubbles the most relevant results to the top. Google doesn't even provide this information in results. It's not something we feel we should put the effort into unless there is a huge call for it and we better understand how this feature would be useful.

MPhamWMF subscribed.

Closing out low/est priority tasks over 6 months old with no activity within last 6 months in order to clean out the backlog of tickets we will not be addressing in the near term. Please feel free to reopen if you think a ticket is important, but bare in mind that given current priorities and resourcing, it is unlikely for the Search team to pick up these tasks for the indefinite future. We hope that the requested changes have either been addressed by or made irrelevant by work the team has done or is doing -- e.g. upgrading Elasticsearch to a newer version will solve various ES-related problems -- or will be subsumed by future work in a more generalized way.

RhinosF1 removed a project: Discovery-Search.
RhinosF1 subscribed.

Re-opening tasks and removing from team workboard per IRC feedback given yesterday and discussion with MPham.