eftsung / pygr

Automatically exported from code.google.com/p/pygr
0 stars 0 forks source link

pygr.Data.dir search improvement #14

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Right now, pygr.Data.dir returns matches on first part of the given 
argument. It will be more convenient if we could add more search engine on 
pygr.Data resources.

1. pygr.Data.dir() : allow empty query as full search like pygr.Data.dir
('')
2. partial match search by string member check :
>>> 'ab' in 'abc'
True
Thus we can do like this,
pygr.Data.dir('HUMAN') => returns all resources if resource name 
has 'HUMAN' string in it.
3. regular expression. Above 2 can be improved more if we add re module 
search on pygr.Data.dir, say pygr.Data.regexp('*.hg17')

Original issue reported on code.google.com by deepr...@gmail.com on 3 Jun 2008 at 9:08

GoogleCodeExporter commented 8 years ago
This seems very much in line with our goals for 0.8, especially if we want a web
interface that gives useful search capabilities

Original comment by cjlee...@gmail.com on 11 Sep 2008 at 4:03

GoogleCodeExporter commented 8 years ago
Attached you will find a patch which adds regex support, as well as makes dir() 
work 
as dir('').

Original comment by mare...@gmail.com on 17 Feb 2009 at 7:29

Attachments:

GoogleCodeExporter commented 8 years ago
MySQL supports REGEXP queries so in principle that can be executed server side
instead of client-side as you do it.  Is that worth implementing?  My 
impression is
that REGEXP support across different database vendors is spotty:
http://trentrichardson.com/2008/10/23/exploring-various-sql-regex-syntax/

For backwards compatibility, maybe the matchType should default to 'p' for 
prefix?

It also strikes me that your method could be generalized easily to search other
information than just the pygr Data ID, such as the description.  That would 
make
this a lot more useful. 

Original comment by cjlee...@gmail.com on 18 Feb 2009 at 10:22

GoogleCodeExporter commented 8 years ago
Attached you will find a patch which replaces client-side regex parsing for 
MySQL 
with server-side processing; I have also re-posted the first patch in git 
format-
patch format, for merging convenience.

matchType does default to 'p', I have set it so in the top-level dir().

As for querying other fields, I've got something in mind but need to think 
about it 
a bit more before submitting any code.

Original comment by mare...@gmail.com on 21 Feb 2009 at 1:19

Attachments:

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Decided that querying other fields reaches beyond the scope of the original 
issue 
and it should be addressed by a separate one. Therefore, the present issue is 
now 
marked "for review".

PS. It has been mentioned in the patch but just to make it clear, taking 
advantage 
of server-side regex support in MySQL bumps its minimal version number required 
by 
Pygr - it is now 4.1.

Original comment by mare...@gmail.com on 3 Mar 2009 at 2:15

GoogleCodeExporter commented 8 years ago
Added test to new test framework and also oldtests.  The latter was important 
because
currently only oldtests actually runs dir() tests on MySQL pygr data servers. 
Commits merged to master.

Original comment by cjlee...@gmail.com on 4 Mar 2009 at 11:02