Comments (2)
after some playing around I found a valid form of the query i was imagining, and it fit what i was expecting:
.or(`name.ilike.%mason%,where_now.ilike.%mason%`)
i modified the dataprovider's getList function near the end where it checks for a 'q' field to complete the query. Instead of adding on successive .ilike( ) selectors, I build a string and pass it into one or( ) selector at the end:
if (q) {
let queryString = ""; //create a query string to put into an or( ) selector
const fullTextSearchFields = Array.isArray(resourceOptions)
? resourceOptions
: resourceOptions.fullTextSearchFields;
fullTextSearchFields.forEach((field, index, array) => {
/* query = query.ilike(field, `%${q}%`); */ // existing method - add on successive ilike selectors
queryString += `${field}.ilike.%${q}%`; // new method - concatenate the ilike queries into one string
if (index < array.length - 1) {
queryString += ","; //add commas between the selectors, but not at the end
}
});
query.or(queryString); //add an or( ) selector using the built query string
In the case of above the above example, now my list returns with the two "Players" whose names contain 'mason'. I can also search for 'retired' and find the 8 "Players" with 'retired' in where_now.
I will add in other fields and see if this works like I expect it to. Does this implementation make sense?
from ra-supabase.
This has now changed in 2.0.0
. See the release notes
from ra-supabase.
Related Issues (18)
- Release HOT 5
- Auth with social providers HOT 7
- Using useGetList with a neq suffix causes an error HOT 2
- Links in readme are not working HOT 1
- Signup flow not working as intended HOT 9
- Add support for React-admin 4.x HOT 20
- No release notes for 2.0.0 HOT 1
- Configure custom id/primary key name HOT 5
- Can't choose other db schema than public in supabaseDataProvider HOT 2
- Global headers passed to supabase client are ignored HOT 2
- Error: No API key found in request HOT 8
- AutocompleteInput inside of ReferenceInput HOT 3
- Error: TypeError: primaryKeys is undefined HOT 5
- Upload Images HOT 1
- Error in README
- using supabase-js client directly HOT 1
- deleteMany - does not work correctly HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ra-supabase.