irods-contrib / metalnx-web

Metalnx Web Application
https://metalnx.github.io/
BSD 3-Clause "New" or "Revised" License
36 stars 36 forks source link

In Metadata search allow choice of AND|OR in how to combine result sets #117

Open d-w-moore opened 4 years ago

d-w-moore commented 4 years ago

if one has two data objects:

aa
bb

and does

imeta set -d aa ONE 1
imeta set -d bb TWO 2

A Metadata Search in MetaLnx containing two criteria ( Attr ONE = Value 1) and (Attr TWO = Value 2) turns up both aa and bb.

Clearly this is a union of individual result sets to form a total. One might sometimes like, in applications of more than one criterion, to have an intersection as opposed to a union (aka an "AND" vice "OR")

A choice along these lines should be offered; there are definitely use cases in which a user would prefer that the addition of new criteria would narrow down the number of search hits, as opposed to expanding the number of hits.

michael-conway commented 4 years ago

also address JY...

In my examples, I am avoiding accentuated characters in order to avoid extra complication. As for logging sql requests, I am seeing a difference between a "imeta" query and a metaLnx query. It was worthwhile logging sql requests: I did not do it as I was thinking about an other problem (problems with viewing the results). For instance, with "imeta qu -d", I do see the sql request which is searching the files for the criteria I gave: select distinct R_COLL_MAIN.coll_name ,R_DATA_MAIN.data_name from R_COLL_MAIN , R_DATA_MAIN , R_OBJT_METAMAP r_data_metamap , R_META_MAIN r_data_meta_main where r_data_meta_main.meta_attr_name =? AND r_data_meta_main.meta_attr_value = ? AND R_COLL_MAIN.coll_id = R_DATA_MAIN.coll_id AND R_DATA_MAIN.data_id = r_data_metamap.object_id AND r_data_metamap.meta_id = r_data_meta_main.meta_id order by R_COLL_MAIN.coll_name, R_DATA_MAIN.data_name whereas for the metalnx, I only see: select distinct r_coll_meta_main.meta_attr_name from R_META_MAIN r_coll_meta_main where upper (r_coll_meta_main.meta_attr_name ) like ? The metalnx search engine is looking at both collection metadata and files metadata. So the query above make sense as it is also querying for collections metadata but the query on files metadata does not seem to be triggered. It looks like it does not find anything attached to the collections (that is the case) and it stops there. For "imeta qu -d", I am forcing the search on files metadata.