0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-07 13:19:19 +08:00
discourse/spec/requests/api/search_spec.rb
David Taylor 9527868295
DEV: Replace JS build system with Rolldown (#35963)
This replaces the old ember-cli build with a modern Rolldown build. In
local testing, this provides an 80% improvement in build times, while
remaining 100% backwards compatible for themes and plugins.

As part of this move, we have decided to stop using a proxy in front of
Discourse for development. Development should now be done directly
against the Rails server.

`bin/ember-cli -u` has been replaced with `bin/dev`. This will launch
Rails on `:3000`, and will run the rolldown build in the background. Log
output from both processes will be shown with an appropriate prefix. You
should visit `:3000` in your browser. `:4200` will no longer serve
anything.

To help with migration, `bin/ember-cli` is now a backwards-compatible
shim. It will print help information, and will launch a lightweight
server on `:4200` with instructions to move to `:3000`.

If you prefer to launch Rails and the JS build as separate commands, you
can still do that. Rails boot commands are unchanged, and the rolldown
development builder can be run using `bin/dev --only ember`.

https://meta.discourse.org/t/403908

---------

Co-authored-by: Jarek Radosz <jarek@cvx.dev>
Co-authored-by: Chris Manson <chris@manson.ie>
2026-05-29 11:11:55 +01:00

65 lines
2.4 KiB
Ruby
Vendored

# frozen_string_literal: true
require "swagger_helper"
RSpec.describe "groups" do
let(:admin) { Fabricate(:admin) }
before do
Jobs.run_immediately!
sign_in(admin)
end
path "/search.json" do
get "Search for a term" do
tags "Search"
operationId "search"
consumes "application/json"
parameter(
name: :q,
in: :query,
type: :string,
example:
"api @blake #support tags:api after:2021-06-04 in:unseen in:open order:latest_topic",
description: <<~MD,
The query string needs to be url encoded and is made up of the following options:
- Search term. This is just a string. Usually it would be the first item in the query.
- `@<username>`: Use the `@` followed by the username to specify posts by this user.
- `#<category>`: Use the `#` followed by the category slug to search within this category.
- `tags:`: `api,solved` or for posts that have all the specified tags `api+solved`.
- `before:`: `yyyy-mm-dd`
- `after:`: `yyyy-mm-dd`
- `order:`: `latest`, `likes`, `views`, `latest_topic`
- `assigned:`: username (without `@`)
- `in:`: `title`, `likes`, `personal`, `messages`, `seen`, `unseen`, `posted`, `created`, `watching`, `tracking`, `bookmarks`, `assigned`, `unassigned`, `first`, `pinned`, `wiki`
- `with:`: `images`
- `status:`: `open`, `closed`, `public`, `archived`, `noreplies`, `single_user`, `solved`, `unsolved`
- `group:`: group_name or group_id
- `group_messages:`: group_name or group_id
- `min_posts:`: 1
- `max_posts:`: 10
- `min_views:`: 1
- `max_views:`: 10
If you are using cURL you can use the `-G` and the `--data-urlencode` flags to encode the query:
```
curl -i -sS -X GET -G "http://localhost:3000/search.json" \\
--data-urlencode 'q=wordpress @scossar #fun after:2020-01-01'
```
MD
)
parameter name: :page, in: :query, type: :integer, example: 1
produces "application/json"
response "200", "success response" do
expected_response_schema = load_spec_schema("search_response")
schema expected_response_schema
let(:q) { "awesome post" }
let(:page) { 1 }
run_test!
end
end
end
end