create GET /ideas?filter[title][like]#62
Conversation
|
@mrkvon thank you for the fix commit! |
|
@agatatalita my pleasure. When this is ready for review, will you, @agatatalita, remove the "WIP"? |
|
@mrkvon and @ditup/glodne-czyzyki It is ready for review now : ) |
mrkvon
left a comment
There was a problem hiding this comment.
Nice, clean work, almost ready to merge. Only the json-schema validation for a query item could be improved and some test(s) added for this.
Note to self: we should validate the json-schemas we use. Now invalid json-schemas seem to pass.
| }, | ||
| keywordsList: { | ||
| type: 'array', | ||
| items: 'string', |
There was a problem hiding this comment.
Is 'string' a valid json schema? Seems that https://www.jsonschemavalidator.net/ is not able to parse it as such.
Would be also nice to see some test for this, i.e. not allow empty strings and have maximum length of a string, perhaps also strings may want to be separate words? How do you @agatatalita imagine valid items? What do they represent? (word, a few words, ...)
- what is the minimum and maximum length of the query item?
- can query item contain a blank space? (i.e. is it a separate word?)
- does query item have other requirements? (i.e. what about leters, numbers, special characters, upper or lowercase)
If I receive the specification, I'd happily implement this.
There was a problem hiding this comment.
- what is the minimum and maximum length of the query item?
@mrkvon do you have any suggestions? what I would be thinking now, the maximum is for sure title.length maximum, but maybe it should be shorter? I believe there are some prepared ways to do it already, we may have it in mind - to optimize words search? So far we should choose something quite quick and simple. - can query item contains a blank space? (i.e. is it a separate word?)
I was thinking it can, So it will be possible to look for 'big dogs', 'cats'. I was probably imagining using it with one keyword now or having something like adding keywords so: the user types 'big dogs' and again to the blank input - 'cats'. So the user can type the whole title and she should be able to find the proper idea. - does query item have other requirements? (i.e. what about letters, numbers, special characters, upper or lowercase)
I was not thinking about. Probably it is the same as for idea title.
| }); | ||
| }); | ||
|
|
||
| describe('GET /ideas?filter[title][like]=string1,string2,string3', () => { |
There was a problem hiding this comment.
So do I understand correctly that the client will be responsible for splitting the user's raw input into separate words (and send them as separate query items)?
There was a problem hiding this comment.
I was thinking about it as about keywords, where each keyword is added separately and consciously by the user on the client side. Not like dividing a string into smaller pieces.
I am happy here with every way which will work and be useful for the user.
| * @param {integer} offset - pagination offset | ||
| * @param {integer} limit - pagination limit | ||
| * @returns {Promise<Idea[]>} - list of found ideas | ||
| */ |
There was a problem hiding this comment.
we could also think whether we need substring search or just word or perfix search (those can be faster)
There was a problem hiding this comment.
More efficient search can be nice, actually. Especially if we get a lot of ideas and if the search has lower computational complexity (O(n) vs. O(1)?). It can be done later, when it's needed, can't it?
There was a problem hiding this comment.
Arango supports word-based prefix matching from what I got on slack(this has probably some index support). If we want something different we can explore it later.
FOR idea IN FULLTEXT(ideas, "title", CONCAT("prefix:", CONCAT_SEPARATOR(",|prefix:", @Keywords)))
RETURN idea
| }, | ||
| keywordsList: { | ||
| type: 'array', | ||
| items: 'string', |
There was a problem hiding this comment.
- what is the minimum and maximum length of the query item?
@mrkvon do you have any suggestions? what I would be thinking now, the maximum is for sure title.length maximum, but maybe it should be shorter? I believe there are some prepared ways to do it already, we may have it in mind - to optimize words search? So far we should choose something quite quick and simple. - can query item contains a blank space? (i.e. is it a separate word?)
I was thinking it can, So it will be possible to look for 'big dogs', 'cats'. I was probably imagining using it with one keyword now or having something like adding keywords so: the user types 'big dogs' and again to the blank input - 'cats'. So the user can type the whole title and she should be able to find the proper idea. - does query item have other requirements? (i.e. what about letters, numbers, special characters, upper or lowercase)
I was not thinking about. Probably it is the same as for idea title.
| }); | ||
| }); | ||
|
|
||
| describe('GET /ideas?filter[title][like]=string1,string2,string3', () => { |
There was a problem hiding this comment.
I was thinking about it as about keywords, where each keyword is added separately and consciously by the user on the client side. Not like dividing a string into smaller pieces.
I am happy here with every way which will work and be useful for the user.
mrkvon
left a comment
There was a problem hiding this comment.
I'm happy with this as it is now. Will you squash+merge @agatatalita ?
agatatalita
left a comment
There was a problem hiding this comment.
Thank you for the quick and neat fixes @mrkvon !
There is one test which is not passing.
@mrkvon look at it please (any time, it is not blocking me from anything)