[GH-ISSUE #173] Search function clarification #127

Closed
opened 2026-02-25 23:33:30 +03:00 by kerem · 9 comments
Owner

Originally created by @ekianjo on GitHub (Sep 25, 2019).
Original GitHub issue: https://github.com/go-shiori/shiori/issues/173

Hi, I would like to know what is actually searched when searching in shiori?
Does it crawl titles only? or titles + tags ? or titles + tags + excerpts ? or titles + tags + excepts + cached content?

Originally created by @ekianjo on GitHub (Sep 25, 2019). Original GitHub issue: https://github.com/go-shiori/shiori/issues/173 Hi, I would like to know what is actually searched when searching in shiori? Does it crawl titles only? or titles + tags ? or titles + tags + excerpts ? or titles + tags + excepts + cached content?
kerem closed this issue 2026-02-25 23:33:30 +03:00
Author
Owner

@RadhiFadlillah commented on GitHub (Sep 25, 2019):

Shiori will search the keyword in URL, title, excerpts and cached content, as can be seen here : github.com/go-shiori/shiori@89aad30a17/internal/database/sqlite.go (L238-L250)

If you include or exclude a tag, then it will lookup on the tags as well.

<!-- gh-comment-id:534936058 --> @RadhiFadlillah commented on GitHub (Sep 25, 2019): Shiori will search the keyword in URL, title, excerpts and cached content, as can be seen here : https://github.com/go-shiori/shiori/blob/89aad30a177a512ef3984699202c26d8c5cd1f89/internal/database/sqlite.go#L238-L250 If you include or exclude a tag, then it will lookup on the tags as well.
Author
Owner

@ekianjo commented on GitHub (Sep 25, 2019):

sorry it's not clear for me, how do you include or exclude a tag when doing the search?

<!-- gh-comment-id:535009020 --> @ekianjo commented on GitHub (Sep 25, 2019): sorry it's not clear for me, how do you include or exclude a tag when doing the search?
Author
Owner

@RadhiFadlillah commented on GitHub (Sep 25, 2019):

In command line interface, from print command you can use -t flag to include tags and -e flag to exclude tags. In web interface, in search bar use tag:tagname to include tags and -tag:tagname to exclude tags.

In web interface you can also use tags dialog. To include tags just click on the tag name you want to include, and to exclude use Alt + Click on the tag name that you want to exclude.

<!-- gh-comment-id:535018278 --> @RadhiFadlillah commented on GitHub (Sep 25, 2019): In command line interface, from `print` command you can use `-t` flag to include tags and `-e` flag to exclude tags. In web interface, in search bar use `tag:tagname` to include tags and `-tag:tagname` to exclude tags. In web interface you can also use tags dialog. To include tags just click on the tag name you want to include, and to exclude use Alt + Click on the tag name that you want to exclude.
Author
Owner

@8bitgentleman commented on GitHub (Sep 25, 2019):

2 questions

  1. Is there and API endpoint to search shiori?
  2. Is there a documentation page for tidbits like adding tag:tagname or is it just in the code for now?
<!-- gh-comment-id:535268111 --> @8bitgentleman commented on GitHub (Sep 25, 2019): 2 questions 1. Is there and API endpoint to search shiori? 2. Is there a documentation page for tidbits like adding tag:tagname or is it just in the code for now?
Author
Owner

@RadhiFadlillah commented on GitHub (Sep 26, 2019):

@8bitgentleman

Is there an API endpoint to search shiori?

Yeah, there is. First you need to login via POST /api/login. It accepts JSON object like this :

{
  "username": "shiori"      // The username
  "password": "gopher",     // The password
  "remember": 5,            // How long session is, negative means session won't expired
  "owner": true,            // Specify that this login is for owner
}

It will returns the session ID and logged in account data like this :

{
    session: some-random-uuid-v4-key,
    account: {
        username: shiori,
        owner: true
    }
}

Now we can use endpoint GET /api/bookmarks. It accepts several URL queries:

keyword : keyword that want to be searched
tags    : tags that want to be included
exclude : tags that want to be excluded
page    : page number, default 1

To access the endpoint, attach the session ID as X-Session-ID header and send the request. For example, you want to get bookmarks in page 1 :

curl 'http://localhost:8080/api/bookmarks?page=1' \
    -H 'X-Session-ID: session-id'

To get bookmarks which contain keyword "interview" :

curl 'http://localhost:9000/api/bookmarks?keyword=interview' \
    -H 'X-Session-ID: session-id'

To get bookmarks which use tag "america" and "scary" :

curl 'http://localhost:9000/api/bookmarks?keyword=&tags=america,scary'' \
    -H 'X-Session-ID: session-id'

The output will be array of bookmarks like this :

{
  "bookmarks": [
    {
      "id": 2,
      "url": "https://www.theguardian.com/business/2019/may/21/trump-china-trade-war-us-economy-oecd-tariff",
      "title": "Trump's China trade war risks damaging US economy, says OECD",
      "excerpt": "Intensification of tariff dispute also likely to knock almost $600bn off world economy",
      "author": "Richard Partington",
      "public": 0,
      "modified": "2019-08-10 15:22:05",
      "imageURL": "/bookmark/2/thumb",
      "hasContent": true,
      "hasArchive": true,
      "tags": [
        {
          "id": 1,
          "name": "america"
        },
        {
          "id": 2,
          "name": "cold war"
        },
        {
          "id": 20,
          "name": "scary"
        }
      ],
      "createArchive": false
    }
  ],
  "maxPage": 1,
  "page": 1
}

Is there a documentation page for tidbits like adding tag:tagname or is it just in the code for now?

Nope, no documentation yet. The wiki still need lot of works.

<!-- gh-comment-id:535280995 --> @RadhiFadlillah commented on GitHub (Sep 26, 2019): @8bitgentleman > Is there an API endpoint to search shiori? Yeah, there is. First you need to login via `POST /api/login`. It accepts JSON object like this : ``` { "username": "shiori" // The username "password": "gopher", // The password "remember": 5, // How long session is, negative means session won't expired "owner": true, // Specify that this login is for owner } ``` It will returns the session ID and logged in account data like this : ``` { session: some-random-uuid-v4-key, account: { username: shiori, owner: true } } ``` Now we can use endpoint `GET /api/bookmarks`. It accepts several URL queries: ``` keyword : keyword that want to be searched tags : tags that want to be included exclude : tags that want to be excluded page : page number, default 1 ``` To access the endpoint, attach the session ID as `X-Session-ID` header and send the request. For example, you want to get bookmarks in page 1 : ``` curl 'http://localhost:8080/api/bookmarks?page=1' \ -H 'X-Session-ID: session-id' ``` To get bookmarks which contain keyword "interview" : ``` curl 'http://localhost:9000/api/bookmarks?keyword=interview' \ -H 'X-Session-ID: session-id' ``` To get bookmarks which use tag "america" and "scary" : ``` curl 'http://localhost:9000/api/bookmarks?keyword=&tags=america,scary'' \ -H 'X-Session-ID: session-id' ``` The output will be array of bookmarks like this : ``` { "bookmarks": [ { "id": 2, "url": "https://www.theguardian.com/business/2019/may/21/trump-china-trade-war-us-economy-oecd-tariff", "title": "Trump's China trade war risks damaging US economy, says OECD", "excerpt": "Intensification of tariff dispute also likely to knock almost $600bn off world economy", "author": "Richard Partington", "public": 0, "modified": "2019-08-10 15:22:05", "imageURL": "/bookmark/2/thumb", "hasContent": true, "hasArchive": true, "tags": [ { "id": 1, "name": "america" }, { "id": 2, "name": "cold war" }, { "id": 20, "name": "scary" } ], "createArchive": false } ], "maxPage": 1, "page": 1 } ``` > Is there a documentation page for tidbits like adding tag:tagname or is it just in the code for now? Nope, no documentation yet. The wiki still need lot of works.
Author
Owner

@8bitgentleman commented on GitHub (Sep 26, 2019):

Wow this is great, thanks for the quick reply!

<!-- gh-comment-id:535282502 --> @8bitgentleman commented on GitHub (Sep 26, 2019): Wow this is great, thanks for the quick reply!
Author
Owner

@ekianjo commented on GitHub (Sep 26, 2019):

@RadhiFadlillah for the wiki why don't you create issues as to what needs to be better documented, and then the community can help so you don't have to do everything by yourself?

<!-- gh-comment-id:535469567 --> @ekianjo commented on GitHub (Sep 26, 2019): @RadhiFadlillah for the wiki why don't you create issues as to what needs to be better documented, and then the community can help so you don't have to do everything by yourself?
Author
Owner

@matclab commented on GitHub (Sep 30, 2019):

I've added some documentation to the Usage page…
It may be enough to close this issue.

<!-- gh-comment-id:536728813 --> @matclab commented on GitHub (Sep 30, 2019): I've added some documentation to the Usage page… It may be enough to close this issue.
Author
Owner

@RadhiFadlillah commented on GitHub (Oct 3, 2019):

@ekianjo sure I will create new issue for that later.

@matclab thanks, closing this issue now.

<!-- gh-comment-id:537972700 --> @RadhiFadlillah commented on GitHub (Oct 3, 2019): @ekianjo sure I will create new issue for that later. @matclab thanks, closing this issue now.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shiori#127
No description provided.