Servoy / svySearch

Search APIs for Servoy
MIT License
3 stars 1 forks source link

svySearch not finding integers on search #24

Closed roddy-cesoft closed 3 years ago

roddy-cesoft commented 3 years ago

I am using svySearch in my form and I am getting inconsistent results on my searching; especially when trying to search for integers.

For example, I have 10 invoice numbers starting with 107 (one of them is 10790); I only get a result from the search when I type in the whole '10790'.

This implies that the search has setImpliedSearch() is false for integer columns, even when I explicitly set it to true. I have tried this with the invoice number being the only search provider (there is no relationship involved) and with others.

seanthomasdevlin commented 3 years ago

Hi Roddy,

Thanks for using the SvySearch API.

What you observe is expected behavior for a numeric/integer field. All comparisons must be made in the database, so for text columns we can have a "starts-with" or "contains" functionality. But for a numeric column, the search will automatically switch to an exact match.

You could try a modifier that will work on a numeric, such as 1000...1999.

"implied" search means that a user doesn't have to type the column's alias in the search. When set to false, user must type it, i.e. "orderid:10249". It has no effect on the results of the search.

roddy-cesoft commented 3 years ago

Thanks for getting back to me, I was hoping that the search would cast the integer to a string for comparison; is this possible to implement?

seanthomasdevlin commented 3 years ago

Hi Roddy, It's tricky but maybe possible. We have to evaluate it. I created a proper case you can track it: https://support.servoy.com/browse/SVYX-250

roddy-cesoft commented 3 years ago

Thanks very much for evaluating it as a possible solution; I will follow along at the link provided.

Roddy

On Sat, 12 Jun 2021 at 00:30, Sean @.***> wrote:

Hi Roddy, It's tricky but maybe possible. We have to evaluate it. I created a proper case you can track it: https://support.servoy.com/browse/SVYX-250

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Servoy/svySearch/issues/24#issuecomment-859622541, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARKY46PFFFJLDVV2AESAY73TSIMXJANCNFSM46M7MVBQ .

seanthomasdevlin commented 3 years ago

Hi @roddy-cesoft I pushed a fix for this. You can set that a specific search provider is casting integer to text in a query. i.e. simpleSearch.addSearchProvider('orderid').setCastInteger(true); It will be available in the next release (1.3.1) Please test from source for in the meantime.

roddy-cesoft commented 3 years ago

Thanks, that is great :-)

seanthomasdevlin commented 3 years ago

1.3.1 released this morning, also put it in the webinar ;-)