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

feat: search with multiple values #132

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

feat: search with multiple values #132

wants to merge 9 commits into from

Conversation

sjvans
Copy link
Contributor

@sjvans sjvans commented Jul 24, 2023

possible solution for #127

  • changelog

@sjvans sjvans changed the title test: search book with multiple values feat: search with multiple values Jul 24, 2023
Comment on lines +508 to +514
args = (args || []).map(e => {
if (e === '*') return e
const arg = { __proto__: e, toString: (x = e) => this.expr(x) }
if ('xpr' in arg)
arg.xpr = arg.xpr.map(e => (typeof e === 'string' ? e : { __proto__: e, toString: (x = e) => this.expr(x) }))
return arg
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need that in addition to the {xpr} handling in Functions.search()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.tolower(arg) called for xpr element. becomes [object Object] instead of ? in the sql.

if (!('val' in arg)) throw `SQLite only supports single value arguments for $search`
if ('xpr' in arg) {
let xpr = ''
for (const each of arg.xpr) xpr += typeof each === 'string' ? ` ${each} ` : this.search(ref, each)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need an 'and' for strings?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$search=foo bar (= $search=foo AND bar)
--> xpr = [{ val: 'foo' }, 'and', { val: 'bar' }]
--> sql snippet x = ? and x = ?, where x = ? is the result of this.search(ref, each)

@patricebender
Copy link
Member

Would be cool to have this, whats speaking against it?

@danjoa
Copy link
Contributor

danjoa commented Oct 17, 2023

We need to converge all related discussions and decisions.

One of that was in a recent spec meeting: pass through $search input to database without eager translation to CQN in protocol adapters.

We don't have to — and likely shouldn't try to — support full-fledged search on non-HANA dbs; we just should not crash.

@schiwekM
Copy link

@danjoa @sjvans any news on this PR? With @cap-js/hana now being released this "regression" is now also introduced that search strings with whitespace in Fiori elements no longer work. In my opinion at least for HANA /prod scenarios this needs to be enabled by default to not have this regression, which causes frustration on user side.

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 this pull request may close these issues.

4 participants