File search by regular expression - frustration

Started by ubacher, October 25, 2019, 06:11:54 PM

Previous topic - Next topic

ubacher

While selecting files I managed to create duplicates. These have a -1 at the end of the file name.
So I tried selecting those files by searching for File Names and Regular Expression.
My file names are like: 2019-10-25 123-1.JPG

I used the expression .*-1\..*

According to the regular expression tester this should find the files. It does not. What am I doing wrong?
(I tried various other expression since I am not sure if the extension is also included in the file name. No success.)

Mario

#1
You search with which feature?
Finding file names containing a -1 can be done by just searching for

1.

no regular expression or fancy stuff required. Does this work for you?
I wonder if the - is somehow a problem...?
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ubacher

I have to find names containing -1 at the end of the file name.

I tried escaping the - (dash) since I was not sure. This is when I tried the regular expression testing app.

Mario

#3
-1.

should do the trick then. No Regexp.

I wonder, ... how did you create the 'duplicates'?

Please look at the Metadata Panel using the 'Browser' layout.
Scroll down until you reach the "IMatch Metadata" section. Does the special file name tag contain the correct name of the file? With the -1?
If not, does it change when you rename the file to another name? Like ... -2.jpg
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ubacher

If I use the filter panel:File Name and search for the regular expression .*-1..* and include extension it finds the
files it should find.

I also tried other search options: exact phrase. I entered the complete file name and it did not find it.
Somehow the blank after 2019-10-25 seems to be a problem.

As to the metadata: The file name for one of the searched for files is indeed wrong, the -1 is missing.

So I also tried the Exact Phrase search on the filename without the -1 and it did not find the file it either?????
Entered 2019-10-25 033.JPG - and it did not find this existing file using exact phrase and file name search.

Mario

My questions from above again:

How did you produce the duplicates?
Have you renamed the file and back to see if this updates the photools.com tag?

The search bar uses the data cached in the photools.com tag. If the -1 is not in the tag, the search will fail and we now know why.
A normal search on the full file name should work (sans the -1).

If you answer my questions I can schedule time for further analysis.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

akirot

I already stumbled about the same behaviour.
The incidently produced duplicates are addressed in a bugfix (#933) for the upcoming release.
The search for files ending in "-1" does not return the incidently created files.
However the search returns files ending in "-1" if the files had been created before (I created some manually for testing purposes in a different directory.)
(It's nothing really new, I just had no time to report this when I encountered this some weeks ago.)

Mario

Can you check the photools.com metadata for the files in question?

I have a hunch that maybe, under yet unknown conditions, IMatch does not update the file name / folder name / ext tags when a file is copied (?) and the name is changed due to a name collision...(?)
This would explain why the files are effectively hidden from the search...
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ubacher

The files in question were accidentally duplicated - a problem reported in
https://www.photools.com/community/index.php?topic=9338.msg65795#msg65795

I tried renaming the file to -2 but the file name under imatch metadata did not change!

I removed the file from the db and loaded it again. Now the name is right and the search finds it.


Mario

Strange.
When I rename the file, the data is updated.
How did you rename?
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ubacher


Mario

You rename the file with F2 in the Media & Folders View?

Tried that. The Metadata Tag immediately changes after the file has been renamed. I see this in the MD panel using the Browser layout.
You can monitor this in the Metadata Panel. I assume you are using the latest IMatch version?
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ubacher

Tried it again - does not change in the Metadata panel.
Put the variable into VarToy and there it changes.
Imatch is up to date.

akirot

Mario, apparantly your suspicion is right.
In Media & Folders view select a file and do a copy/paste. The new file ending in "-1" is produced.
Selecting the new file the Metadata Browser shows Imach Metadata/File Name without the "-1". (I assume the Metadata are copied only but not adapted correctly.)
A forced rescan fixes this.

Probably this thread should be moved to the bug area.

Mario

Quote from: akirot on October 26, 2019, 07:17:57 PM
Mario, apparantly your suspicion is right.
In Media & Folders view select a file and do a copy/paste. The new file ending in "-1" is produced.
Selecting the new file the Metadata Browser shows Imach Metadata/File Name without the "-1". (I assume the Metadata are copied only but not adapted correctly.)
A forced rescan fixes this.

Probably this thread should be moved to the bug area.

I have identified the source of this problem and fixed it for the next release.
Only the FW search bar is affected by this, and maybe users who have created a data-driven category based on this specific photools.com tag (unlikely).

The database diagnosis in the next release can identify and fix this issue.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook