Closed iemejia closed 11 years ago
Some ideas: catho find regexp catho find --time > date catho find --size == num catho find --size > num
The regex option on sqlite is provided through an extension, for example: https://github.com/oojah/sqlite3-pcre https://github.com/eatnumber1/sqlite-regexp
But there is an alternative, using the re module:
http://docs.python.org/2/library/sqlite3.html#sqlite3.Connection.create_function
doesn't sql 'like' cover this ? isn't it too slow to make the regex in python (even if it's mandatory) ? and finally, and more important, can you return maybe a list of [(catalog,[matches])] or something like that, so that the result shows aditionally in which catalog are the files.
Of course it is a overhead, but LIKE it is not an equivalent as having regular expressions, you can only match one or one_ormore characters with and %, if you are worried about speed we could use simple match via LIKE '%pattern%' and add an extra keyword for matching via regex.
No, I think the regex is the price to pay for the flexibility.
On Thu, Feb 28, 2013 at 7:05 PM, rgamez notifications@github.com wrote:
Of course it is a overhead, but LIKE it is not an equivalent as having regular expressions, you only can match one or one_ormore characters with and %, if you are worried about speed we could use simple match via LIKE '%pattern%' and add an extra keyword for matching via regex.
— Reply to this email directly or view it on GitHubhttps://github.com/iemejia/catho/issues/7#issuecomment-14247427 .
what about the other query types (dates, filesize, etc) ? do you have any idea about how to define them in a possible general way ?
Not really sure about the best option, I would like something such:
catho find [field] == value catho find [field1] == value1 and [field2] > value2 catho find [field1] == [field2]
But I don't remember any command line utility with a similar syntaxis, I think preventing issues with shell scripts and the notation for [optional] parameters
I think that the default option of find must be to allow an string without * or % and just look for names that contain the string, it makes it more intuitive for the user. And the advanced options go with a different argument, like the regex one, or the sql one.
Also, I tried looking for 'Animal Collective' in our test catalog, but I didn't arrive to get the same answer that with cathy, can you check.
I think there is some issue with the space in the name
No, "Animal Collective" is not in the results because is matching just filenames not paths
amazing fix, thanks :)
maybe find is a a better alias for this, it should accept regular expressions, and it searches for filename. what will be the sintax for other criterias e.g. date or filesize ?