Page 1 of 1

Find/Replace in files appears to use a stale index sometimes

Posted: Fri Sep 22, 2023 7:31 pm
by martindholmes
Hi all,

Using Linux, Ubuntu 22.04, <oXygen/> XML Editor 25.1, build 2023070306
I've noticed this problem occasionally with previous versions of Oxygen, but in the last couple of days I've seen it several times.

I do a Find/Replace in Files on all the files in a folder. Then I do a Find to find the replacements I've just made. Nothing is found. Restarting Oxygen solves the problem. It's as though the Find/Replace operation is using an index it created as part of the initial Find/Replace, and not searching the documents again.

I should mention that I often have multiple copies of Oxygen (five or six) running on different desktops with different projects open; I don't know whether that has any bearing or not, but it's the way I always work.

Has anyone else seen this?
Cheers,
Martin

Re: Find/Replace in files appears to use a stale index sometimes

Posted: Mon Sep 25, 2023 9:13 am
by Radu
Hi Martin,

The Find/Replace dialog which shows up when using "Ctrl-F" on an opened document does not have an associated cache, it runs directly over the content which you have opened from disk and which is displayed in the editing area. Maybe some setting in the Find/Replace dialog somehow interferes with this. For example the dialog has a "Wrap around" checkbox, maybe you have unchecked it and when the dialog is shown the caret position is after the place where the searched content is located.
Maybe the next time this happens you take some screenshots showing the opened dialog on your side and the fact that the opened document contains the searched string.

Regards,
Radu

Re: Find/Replace in files appears to use a stale index sometimes

Posted: Wed Sep 27, 2023 8:39 pm
by martindholmes
I don't see a Wrap-around checkbox in my Find/Replace in Files dialog. Maybe you're thinking of the one-file dialog?

Re: Find/Replace in files appears to use a stale index sometimes

Posted: Thu Sep 28, 2023 7:44 am
by Radu
HI Martin,
I got confused when I read this initial line:
I do a Find/Replace in Files on all the files in a folder. Then I do a Find to find the replacements I've just made.
I thought that after find/replace in files you opened each individual file and used the find/replace dialog.
The Find/Replace in Files also does not have any kind of cache. Maybe you can find some consistent way to reproduce this problem and give us some detailed steps.
Regards,
Radu

Re: Find/Replace in files appears to use a stale index sometimes

Posted: Fri Oct 06, 2023 6:41 pm
by martindholmes
It's sporadic and unpredictable, so I can't even reproduce it myself on demand. I was mostly posting to see if anyone else had experienced the same thing, then we might be able to see what was common between our setups and figure out a way to narrow it down.

Re: Find/Replace in files appears to use a stale index sometimes

Posted: Sat Oct 07, 2023 1:56 pm
by chrispitude
I have seen a similar behavior with XSLT refactoring file operations.

Sometimes while working on a refactoring operation, I will run it to the "Preview" point in the refactoring dialog box sequence. If I want to change the results, I edit the .xsl file, then go back from the Preview and click Preview again. When I do this, I get the results from the old XSLT file instead of the changes I just made in the XSLT file. This has happened multiple times, but it is also intermittent.

Re: Find/Replace in files appears to use a stale index sometimes

Posted: Mon Oct 09, 2023 7:22 am
by Radu
Hi,
Also I do not know of any cache (besides caching the DTD and RNG grammars to speed up transformations) kept between subsequent runs of XSLT refactoring operations.
Regards,
Radu

Re: Find/Replace in files appears to use a stale index sometimes

Posted: Mon Oct 09, 2023 1:29 pm
by chrispitude
Hi Radu,

I just realized something. In my case, I am using WSL in Windows 10, which is a linux environment inside Windows. It is possible that there is some kind of filesystem issue because I am running Oxygen in Windows, but I edit files in WSL/Linux using vim. Next time this happens, I will try to dig into the root cause.

Re: Find/Replace in files appears to use a stale index sometimes

Posted: Mon Oct 09, 2023 1:38 pm
by Radu
Hi Chris,
Interesting, there may be indeed some kind of delay between when the file is written on Linux and its updated contents are available to Oxygen on Windows but I'm not familiar at all with WSL.
Regards,
Radu

Re: Find/Replace in files appears to use a stale index sometimes

Posted: Mon Oct 09, 2023 6:46 pm
by jeankaplansky
@here: I'm on Mac OS 14 Sonoma and found that Find/Replace in files is no longer working in a Data Source connection or when I download files locally and bring them into an Oxygen XML Project. I'm using Oxygen XML Editor desktop 25.1

I'm doing a lot of global changes with regex to remove spurious data-uuid attributes and other corrections. Running the Find/Replace in files doesn't work whether I'm working from the context menu with "Selected project resources," "specified path," or the Find menu option. My tried and functional workaround so far is to open each file and do the regex find and replace in each file requiring the changes.

Is this a bug Oxygen needs to look into? I have recurse subdirectories enabled. As far as I know, the find/replace in files was working until last week.

Please help? We use find/replace in files to update thousands of files simultaneously with regex. Is this related to the "stale index" problem?

Thanks very much for any suggestions/input.

-Jean

Re: Find/Replace in files appears to use a stale index sometimes

Posted: Mon Oct 09, 2023 6:46 pm
by jeankaplansky
@here: I'm on Mac OS 14 Sonoma and found that Find/Replace in files is no longer working in a Data Source connection or when I download files locally and bring them into an Oxygen XML Project. I'm using Oxygen XML Editor desktop 25.1

I'm doing a lot of global changes with regex to remove spurious data-uuid attributes and other corrections. Running the Find/Replace in files doesn't work whether I'm working from the context menu with "Selected project resources," "specified path," or the Find menu option. My tried and functional workaround so far is to open each file and do the regex find and replace in each file requiring the changes.

Is this a bug Oxygen needs to look into? I have recurse subdirectories enabled. As far as I know, the find/replace in files was working until last week.

Please help? We use find/replace in files to update thousands of files simultaneously with regex. Is this related to the "stale index" problem?

Thanks very much for any suggestions/input.

-Jean

Re: Find/Replace in files appears to use a stale index sometimes

Posted: Mon Oct 09, 2023 7:13 pm
by jeankaplansky
Find/Replace in files starts to work again when I intentionally turn off "Enable XML search options" I'm working in ASCII. Does "Enable XML search options" only work when using the Oxy XML Author UI?

Re: Find/Replace in files appears to use a stale index sometimes

Posted: Tue Oct 10, 2023 8:11 am
by Radu
Hi Jean,
The documentation for XML Search Options is available here:
https://www.oxygenxml.com/doc/versions/ ... 25_bgk_54b

Once you enable XML search options, even if all XML search option checkboxes are checked, the XML is in a way split in search intervals (element names, attribute names, attribute values, text, etc) and the text to find is searched in each interval separately.
For example if I search for <topic id="care"> with XML search options checked, I will find nothing because my searched string spans multiple intervals (an element name, an attribute name, an attribute value).
But I can search for example for care and limit my search to attribute values using the xml search options in order to find all attribute values which contain care inside them.

Regards,
Radu