Bauble / bauble.classic

this is how Bauble and Ghini both started
GNU General Public License v2.0
10 stars 34 forks source link

looking for plant find accession #220

Closed mfrasca closed 8 years ago

mfrasca commented 8 years ago

this is the failing test test_searchbyplantcode in bauble/plugins/garden/test.py. you can see this with the cuchubo.db database: we have plant 2014.0230.1 if you enter the search '2014.0230.1' (quoted) you will get the correct result: one plant. if you do not quote the search string, you will get 10 results, all accessions (not plants) with accession code starting with 2014.023

mfrasca commented 8 years ago

2014.0230.1 unquoted gets interpreted as numeric, as far as it matches a number, that is up to the second decimal dot, then it's split and again looks numeric. so in practice you're looking for 2014.023 and .1

mfrasca commented 8 years ago

quoted, '4.0230' will match the accession 2014.0230 (and not any other) but quoted, '4.0230.1' will not match the plant, while '2014.0230.1' will.

mfrasca commented 8 years ago

the test applies the wrong strategy: MapperSearch while the one that behaves as described is PlantSearch. it also provides the wrong searches, 2.2.x instead of 1.2.x (x<-[1,2]) and then the PlantSearch should look for accessions ending with the given code, not necessarily completely matching it. The SearchParser should not recognize things like 1.2.1 as a number followed by a string but as a string.