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

Filter and sort on Fulltext search #4412

Closed
gusinacio opened this issue Mar 3, 2023 · 1 comment · Fixed by #4442
Closed

Filter and sort on Fulltext search #4412

gusinacio opened this issue Mar 3, 2023 · 1 comment · Fixed by #4442

Comments

@gusinacio
Copy link
Member

Do you want to request a feature or report a bug?
Feature

What is the current behavior?
I have a specific usecase for text search that is currently not possible with The Graph.

I'm building a marketplace running on Smart Contracts where only the sellers who have at minimum X stake can create listings. Furthermore, the incentive for a seller to stake more tokens is that the order of the products depends on the seller current stake.

Last but not least, a listing has a time frame where it can be found from creation to expiration.

The problem with this, is that full text search doesn't have filters, so it's not possible to filter only for valid listings. The "solution" that I found was to create an entity called SearchableListing , save it and have a derived field inside an entity Block. So I created a blockHandler that every block checks for the list of searchableListing, removing them.

But then, there was another problem where I can't really access derivedFields inside the subgraph and for this to work I had to actively create an array inside block, maintain it, and you know the mess this is going.

What is the expected behavior?

As I said earlier, I want the listings to be sorted by seller stake and this should be true for searching too, at least between X listings with the same text proximity, they should be sorted desc.

Request: where and orderBy in a full text search.

@azf20
Copy link
Contributor

azf20 commented Mar 6, 2023

hey @flametuner - sounds like you might be interested in #4004 for the derived field issue. Will take a look at the PR, thanks!

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 a pull request may close this issue.

2 participants