Questions and comments Readme
QueroBartK opened this issue · 4 comments
Ok, I've just read through the entire readme and I have a few question/comments. I'm just going to sum them in the order that I encountered them:
https://github.com/deitch/searchjs/blob/master/README.md#property-search
Item:
{"level1":{"level2":{"level3":{name: "tom"}}}}
This works also in combination with Deep Search.
It is possible to omit any level in between. So all the following queries will match the above item.
{"name":"tom", "_propertySearch": true} {"level1.name":"tom", "_propertySearch": true} {"level1.level2.name":"tom", "_propertySearch": true} {"level4.name":"tom", "_propertySearch": true} {"level1.level4.name":"tom", "_propertySearch": true}, {"name":"tom", "_propertySearch": true, "_propertySearchDepth": 4} {"level1.name":"tom", "_propertySearch": true, "_propertySearchDepth": 4}
am I understanding this right and would {"level4.name":"tom", "_propertySearch": true}
match {"level1":{"level2":{"level3":{name: "tom"}}}}
even though it never has an object called level4? If so that means that everthing that comes before the dot separator is ignored when using _propertySearch?
(Just trying to clear this up not saying that it should be one way or another)
https://github.com/deitch/searchjs/blob/master/README.md#text-searching
In general, if you search a field that is a string, and the search primitive is a string, then it will be an exact match, ignoring case.
{name:"davi"} will match a record whose content is {name:"davi"}, as well as one whose "name" field matches "Davi" and "DAVID", but not one whose content is {name:"david"} or even {name: "davi abc"}.
small typo here as you say that the field matches "Davi" and "DAVID" but it should be "DAVI"
https://github.com/deitch/searchjs/blob/master/README.md#examples
8.
{email: "john@foo.com"}
- all records that have the email === "john@foo.com", if the record has email as a string; or if email is an array, then each element is checked; or if email is an object, then the keys are checked. All of the following will match:{email:"john@foo.com"}
and{email:["john@foo.com","js@gmail.com"]}
and{email:{"john@foo.com":true}}
does this mean that I can use this to check if a key in a certain object exists? (ps: had to add a link to 8 or it would change the number. It shouldn't lead anywhere)
https://github.com/deitch/searchjs/blob/master/README.md#matchfield
What happens when both text
and word
are true?
am I understanding this right and would {"level4.name":"tom", "_propertySearch": true} match {"level1":{"level2":{"level3":{name: "tom"}}}} even though it never has an object called level4? If so that means that everthing that comes before the dot separator is ignored when using _propertySearch?
(Just trying to clear this up not saying that it should be one way or another)
Nice catch! That definitely is a typo in the README.md. Fixing it now. No, it would not match, because there is no level4
.
small typo here as you say that the field matches "Davi" and "DAVID" but it should be "DAVI"
Yes, indeed. Thank you again. Fixing now.
does this mean that I can use this to check if a key in a certain object exists?
Yes, indeed.
What happens when both text and word are true?
Look down about 10-15 lines in the REAME.md:
Note that text overrides word if both are set to true.