Category Formula

Started by AndyL, August 02, 2014, 12:08:54 PM

Previous topic - Next topic

AndyL

Hi,

I'm having trouble with a category formula that I'm converting from 3.5. The 3.5 formula is "CatNoRecurse@MyCategories.Places.UK.Berkshire.Inkpen" and has 152 images in it. This has been converted by the database converter to "@CatNoRecurse[MyCategories|Places|UK|Berkshire|Inkpen]" and now shows 17,253 entries. So something's not right. I have tried adding ^ & $ regular expression markers around the whole category and the individual elements of the category, but nothing I have tried makes it work.

So what do I need to do to get it to work as before.

Regards

Mario

Anything to say about the "wrong" entries returned? Don't they match the regular expression? From which category do they come from? etc...

From your description ("Formula category shows too many files") I cannot deduce anything, sorry.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

AndyL

I think I have worked out the problem. Adding @All to the front of the category so it now reads "@CatNoRecurse[@All|MyCategories|Places|UK|Berkshire|Inkpen]" seems to have fixed it. It's a shame the converter didn't do this automatically, but maybe it isn't easy to work out when it is needed.

In a similar vein, is it possible to do the equivalent of CatNoRecurse in the category builder?

Regards


Mario

1. Regular expressions using @All in front and not are different! Please see the documentation on @CatNoRecurse for details. This will also explain you why the results differ and when to use what.

2. No.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

AndyL

Yes, reading the documentation was how I found out about @All. These weren't regular expression formula as such. They are all formula automatically converted from my 3.5 database by the database converter. None of my converted formula worked, but they all would have done with the addition of the @All, so it's a shame the converter didn't add the @All.

For any new formulae I need I will spend some time working out the new features of IM5 to make best use of them.

It's a shame about the builder. Maybe a feature for a future version?  :)

Thanks

AndyL

I've been having a bit more of a play and wonder if what I'm seeing is expected behaviour. As an example I have a category

@All|MyCatecories|Places|UK which has many sub categories, but shows a count (5/10,489)

If I now create a sibling category called "UK Only" and use the formula builder to add @CatNoRecurse and the UK category above I get a formula that looks like

"@CatNoRecurse[MyCategories|Places|UK]"

This shows a count of (0/17,253), which seems wrong to me. As I said before adding the @All to the front of the category definition fixes this.

It looks like the 17,253 number is all of the images assigned to MyCategories as the count for this category is shown as (0/17,253) and selecting the new UK Only category does seem to show all these images.

So is this expected behaviour? It doesn't seem obvious if it is.

Regards


thrinn

I can't check it at the moment, but I think you have to escape the pipe symbol with a backslash to get what you want. It is explained in the help, but easily overseen (speaking for myself).
Thorsten
Win 10 / 64, IMatch 2018, IMA

AndyL

I'm using the "Category Formula Editor" you get if you click the "..." next to the formula in the category properties window.

I am then just clicking on formulae and categories and letting it build the string. It doesn't escape the "pipe" and when I add the @All I don't have to either. So I don't think that is part of the problem.

Thanks


AndyL

OK, I found the bit about escaping the "pipe". So I've tried that and I still don't get what I expect. Changing the formula to "@CatNoRecurse[MyCategories\|Places\|UK]" I now get 10,446 images rather than the 5 I expect. Adding a $ on the end so it looks like "@CatNoRecurse[MyCategories\|Places\|UK$]" does now give the expected result of 5 images. I don't know where it is getting the extra 10,000+ images from.

So actually I think the problem is really the category formula editor (and maybe the database converter). Creating a new formula in the editor by clicking on @CatNoRecurse and a category doesn't create a formula that does what you (I) expect. It should really know a regular expression is needed and add then necessary @All, \|, $ or whatever to make it do what is expected.

The help says ...

Although you can type the formula directly into the property grid below the category tree, it is often more convenient and safer to use the category formula editor.

In this case I don't think that is true :)

Thanks


JohnZeman

Quote from: AndyL on August 02, 2014, 09:54:22 PM
OK, I found the bit about escaping the "pipe". So I've tried that and I still don't get what I expect. Changing the formula to "@CatNoRecurse[MyCategories\|Places\|UK]" I now get 10,446 images rather than the 5 I expect. Adding a $ on the end so it looks like "@CatNoRecurse[MyCategories\|Places\|UK$]" does now give the expected result of 5 images. I don't know where it is getting the extra 10,000+ images from.

So actually I think the problem is really the category formula editor (and maybe the database converter). Creating a new formula in the editor by clicking on @CatNoRecurse and a category doesn't create a formula that does what you (I) expect. It should really know a regular expression is needed and add then necessary @All, \|, $ or whatever to make it do what is expected.

The help says ...

Although you can type the formula directly into the property grid below the category tree, it is often more convenient and safer to use the category formula editor.

In this case I don't think that is true :)

Thanks

I just did some testing here and I have to agree with you Andy.  As soon as I add @CatNoRecurse to a formula in my test category I'm getting an image count of over 50,000 instead of the 23 I was expecting. :o

"@CatNoRecurse[@Keywords|Zeman Photos|Things|Freedom Rocks|Adair County]"

Mario

This expression will consider all categories with

@Keywords
Zeman Photos
Things
Freedom Rocks
Adair County

Please note the special meaning of | when used in regular expressions. Please see the detailed explanation given in the help for @Catgeory.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

JohnZeman

Ah ha!  I have learned something today so my dad would tell me it's a good day.  ;)

I use many category formulas but until now I had never tried one that does not use @All but does use one of the @Cat functions.  Escaping the pipes did indeed resolve my issue.

"@CatNoRecurse[@Keywords\|Zeman Photos\|Things\|Freedom Rocks\|Adair County]"

Thanks Mario.

Mario

There was a major performance improvement introduced in the the last build, which has to do with using @All in @Cat... or not. When using @All, IMatch takes the expression as a complete path (@All|Studio|Portrait) instead of trying to match the regular expression Studio|Portrait. Different results, much faster when @All is used. See help for details.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

AndyL

Having read and re-read the help I now understand what is going on and I think there is room for improvement.

First, the database converter. It generated formula that were plain wrong and that was where I started from. "Why are all my formula giving silly results". Looking at them there was nothing obviously wrong. I did read the help, but the important bits didn't register at first. I did also try searching the forums, but didn't find anything useful.
I would have thought it would have been possible to change the converter so it added the @All or whatever is necessary to make the formula much closer to how it would have worked in 3.5

Then, coming from 3.5 where generating formulae was a simple click of a few boxes, I tried the Category Formula editor. Clicking @CatNoRecurse and a category again generates something which I cannot believe anyone would want or expect. In my case, clicking on the category MyCategories.Places.UK generated a formula which was essentially saying "MyCategories" OR "Places" OR "UK". Is that really what anyone would want? Again I think the Category Editor should be "More intelligent" and add the @All or escape the "|"  and add a "$" or whatever. Something to get you much closer to what I think most people would have guessed the clicks would have generated.

Actually I think the whole distinction between regular expressions and plain "names" should be more obvious. Regular expressions are great and a very powerful tool that I hope to make great use of, but they are very much a "Power user's" tool. It should be obvious you are using them, currently it isn't. Maybe adding some thing like RE() round the string (e.g. "@CatNoRecurse[RE(MyCategories\|P.*)]") so you know you are doing something different and "here be dragons"

I hope you don't think I'm being too negative. This is meant as constructive criticism. I general I think Imatch is great and this new version has some great new features. Thanks


Mario

If you have found a bug, please report it in the appropriate forum.
Posts in General Discussions are not on my retain list and I will not remember them next week.

Note: The change in the @Cat... formulas was introduced in the version released almost two weeks ago. Since most users should by now have converted their database, the risk of other users running into the same problem is rather low.

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

AndyL

I don't know if I have found a bug. This may be the way you intend things to work. It just isn't what I expected. If you say it is a bug, then I will report it wherever necessary.

I have only just "Jumped". This is the first version of V5 I have tried (other than brief dabbling with a beta version), so I hit the "conversion problem" straight away. There may still be others who haven't jumped yet (although I guess you know the numbers :) ).

The category editor "problem" is nothing to do with database conversion. This may be a problem for new and old users alike. It may be that the change to the @Cat formulae has changed how the results of the category editor are interpreted. I don't know, I haven't tried a version prior to this change. So, again, is the current behaviour what you intended? If not, then I guess it is a bug and I'll report it wherever you want.

I'm on the start of a steep learning curve with lots of familiar things not doing quite what I expect. This one I felt was sufficiently "unexpected" to ask. I had assumed I would find others discussing it and maybe get a "don't be silly you should have done this" reply. As I haven't maybe it is a new change brought about by the new @Cat stuff.

Regards

Mario

Please write up a bug report for everything you consider a bug.
I can't remember all the posts, today alone I've read and replied to maybe 30...
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook