Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add SMW Ask API as search backend option #625

Merged
merged 2 commits into from
May 18, 2023

Conversation

simontaurus
Copy link
Contributor

@simontaurus simontaurus commented May 18, 2023

  • allows a fully customizable SWM Ask query for the search suggestions
  • solves the problem with displaytitle like T143396

@alistair3149 alistair3149 merged commit 2e3e5fe into StarCitizenTools:main May 18, 2023
4 checks passed
@simontaurus simontaurus deleted the add-smw-ask-api branch May 19, 2023 02:32
@alistair3149
Copy link
Member

I am recently working on improving and refactor the search module in Citizen, part of the goal is to allow triggering other search endpoint with a text command.

Would you mind to explain to me how does the current SMW Ask search work in Citizen? I experimented with it but I was not able to get it working, so I figured it might be more suitable to ask you about it.

@simontaurus
Copy link
Contributor Author

simontaurus commented Aug 17, 2023

Sorry for the late response.
Basically it creates a SMW Ask API query from the user input using wgCitizenSearchSmwAskApiQueryTemplate which defaults to '[[Display_title_of::~*${input}*]] |?Display_title_of=displaytitle |?Page_Image=thumbnail |?Description=desc'.
So it selects pages where the Display title contains the search string and returns the full display title as well as the Page_Image property as thumb and the Description property as description.
Of course these properties have to exists and need to be populated in the mediawiki instance or need to be replaced by properties that do (this is clearly missing in my documentation).

  • Property:Display_title_of is build-in but needs to be set within pages (see docs). To use the normal display title, this part of the query template should be [[~*${input}*]] (see docs) or, to match both, '[[Display_title_of::~*${input}*]] OR [[~*${input}*]].
  • Property:Page_Image comes with Extension:Semantic_Extra_Special_Properties and needs to be enabled (see docs)
  • Property:Description is a custom property (created by the user with [[Has type::text]]) that hold a short description text for a page

You can find a working example here. If you type Demo in the search bar the template '[[Display_title_of::~*${input}*]] |?Display_title_of=displaytitle |?HasImage=thumbnail |?HasDescription=desc' is used (see browser debug tools) and you will find e. g. DemoUser with all relevant properties pupulated.

Let me know if a can support further in the refactoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants