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

Question/Feature Request: Pinned/Forced Search Results at Specific Positions #1741

Closed
b-barry opened this issue May 20, 2024 · 5 comments
Closed

Comments

@b-barry
Copy link

b-barry commented May 20, 2024

Description

Hello Typesense Team,

We are looking to build a feed builder for articles, similar to the book search functionality available on books-search.typesense.org. Our goal is to allow users to save their search queries, including filters, facets, and sorting options.

We would like to introduce an advanced feature that enables us to pin or force specific search results at a particular position in the results list. For example, when fetching all "Biography" books ordered by the last publication date, we want to display three preselected books as the first three results or based another query result, regardless of their publication date. This feature would be useful for scenarios where a user has paid to have their content appear in the top positions for a specific search query.

We are wondering if there is a simple and performant way to achieve this with Typesense. Ideally, we would like to avoid handling this logic on the client side.

Any guidance or suggestions you can provide would be greatly appreciated. If this feature is not currently available, we would like to request its consideration for future development.

Thank you for your time and for creating such an amazing search engine.

Steps to reproduce

N/A

Expected Behavior

N/A

Actual Behavior

N/A

Metadata

Typesense Version:

OS:

@smlparry
Copy link

Hi there!

It seems like you are looking for the "Curation" feature: https://typesense.org/docs/26.0/api/curation.html

With this, you can specify what search results to "pin" to the top (via the "includes" property in an override)

@b-barry
Copy link
Author

b-barry commented May 21, 2024

Hello,

Yes. Thanks for the quick response. It seems the override will works when we know the id. But I didn't find an option that allow to add a sub query ( dynamic). I would like to be able to add in the include a query to fetch for example 3 articles from another category and insert them from the position 10.
It is correct or I am missing something in the documentation?

@b-barry
Copy link
Author

b-barry commented May 21, 2024

Also I was wondering if the includes can includes id from other collections?

@jasonbosco
Copy link
Member

For that level of customization, you'd want to first run a search query to fetch document IDs to pin, and then send those IDs in the pinned_hits search parameter in the second search query (documented under this table), without using the overrides endpoint.

pinned_hits can be dynamically changed at search time using any criteria you need

@b-barry
Copy link
Author

b-barry commented May 21, 2024

@jasonbosco @smlparry Thanks for the help. I will try it

@b-barry b-barry closed this as completed May 21, 2024
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

No branches or pull requests

3 participants