How to: API request on partial string


Bruno     4 months ago


I created a table (companies, for example) with several fields (name, address1, address2, zipcode, city).

As a user, I may not know the exact syntax of my search. For example, if I search for a company called "Acme Industry Inc., I might want to just type in" Acme "and get the result.

Through Saltcorn I manage to do this and get my result.

In SQL, I will be able to do it with "Acme%" for example and get my result.

With the API embedded in Saltcorn, I can't do it (maybe I don't know how to do it well). It seems to be waiting for the full chain of characters.

Can any of you guide me?

Many thanks




tomn      4 months ago

This should work: GET /api/mytablename?_fts=Acme - i just verified with a test

("fts" is short for Full Text Search) 

Bruno      4 months ago

Thank you, what you suggested worked perfectly fine, though I am facing another issue linked to it.

Let me explain what I would like to do:
I don't want to make a research on the whole table, but only on a certain field.
However, I still want to be able to research using an incomplete name (retake the example of Acme)

Don't hesitate to ask me for more details. 

Sign up to post a reply