Searching for Text in Reused Components in Current Dita Map Hierarchy

jmorales
Posts: 75
Joined: Tue Oct 30, 2018 9:47 pm

Searching for Text in Reused Components in Current Dita Map Hierarchy

Post by jmorales » Wed Oct 02, 2019 2:37 am

Hi, I have some text that needs to appear in several topics in my book, so I put it in a separate component and did a conref to that component from each of the affected topics. Then I did a Find/Replace in Files, with the find target being some text in the reused component, and set the scope of my search to Current DITA Map Hierarchy. The search didn't find anything, which sort of makes sense because the reused text is no longer directly present in my topics. On the other hand, that means that it's going to be difficult to find the location of that reused text in my topics in this book in the future. I would have to remember the name of the component that is being reused, and do a find on the name of the component.

To find things easily in my book, it would help a lot if a search of Current DITA Map Hierarchy would also return any topics that contain the find target as part of an embedded component. Or,if you feel that you cannot change the meaning of "Current DITA Map Hierarchy", then perhaps you could add another scope to the list called "Current DITA Map Hierarchy and Embedded Components." I feel that this would be a tremendously helpful feature even if it makes the search run slower.

On the other hand, is there already some way to get the effect that I want? Perhaps I just haven't stumbled across it.

Thanks!

Radu
Posts: 7579
Joined: Fri Jul 09, 2004 5:18 pm

Re: Searching for Text in Reused Components in Current Dita Map Hierarchy

Post by Radu » Wed Oct 02, 2019 8:21 am

Hi,

Our Find/Replace in Files action searches only in the current content of the XML document, it does not expand content references to search also inside them.
The best practice when you have topics containing only reusable content is to also refer to them in the DITA Map, setting the "processing-role='resource-only'" attribute on the topicref to indicate that the topic is not published but it contributes reusable components for other topics.
Once that topic will be referenced in the DITA Map the "Find/Replace In Files" will start finding the content inside it.
You could for example have a special "reusables.ditamap" which refers to all topics with reusable components and is referenced in the main DITA Map:

https://github.com/oxygenxml/dita-proje ... -practices

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

jmorales
Posts: 75
Joined: Tue Oct 30, 2018 9:47 pm

Re: Searching for Text in Reused Components in Current Dita Map Hierarchy

Post by jmorales » Thu Oct 03, 2019 12:35 am

Thanks Radu. I can see that including the reusable content as a "resource-only" entry in the ditamap would help. Where it gets a little complicated is if you have a number of components that are reused in topics in one book, and maybe some of those components are also reused in topics in other books. If you group components together into a collection, and add it to your ditamap as a "resource-only" entry, but your current book uses only some of those components, then your Find may locate text in components that are not really used in the current book. It seems like the only sure way to prevent this would be to always store each component in a separate file, right? Then you could add "resource-only" entries in your ditamap for only the components you are really using.

I can see this as a viable workaround, but going forward, it would certainly be more convenient if Find/Replace in Files could expand content references to also search inside them. The Find results could list all the topics that contain the target text, either directly or within a nested component. Then you could double-click each topic in the Find results to easily view each found item in the context of the topic where it is used. Just something for you to consider. Author Mode already gives a combined view of a topic and the text from any components it references, so clearly you already know how to do this sort of thing.

Thanks for your consideration and for your suggestion!

Radu
Posts: 7579
Joined: Fri Jul 09, 2004 5:18 pm

Re: Searching for Text in Reused Components in Current Dita Map Hierarchy

Post by Radu » Thu Oct 03, 2019 8:10 am

Hi,

Thanks for the improvement request, I added an internal issue for it.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

kirkilj
Posts: 107
Joined: Fri May 14, 2010 12:14 am

Re: Searching for Text in Reused Components in Current Dita Map Hierarchy

Post by kirkilj » Thu Oct 03, 2019 8:43 pm

+1 on this enhancement request.

In the mean time, would it be sufficient to invoke the "Open Map in Editor with resolved topics" in Author mode and then invoke Find All on the combined content? It's not ideal for replacements; however, since you'd have to invoke the "Edit Reference" function to get read/write access and make changes in the referenced file. This might be sufficient with a small docset, but it would probably be untenable for any map consisting of hundreds of topics or more.

Radu
Posts: 7579
Joined: Fri Jul 09, 2004 5:18 pm

Re: Searching for Text in Reused Components in Current Dita Map Hierarchy

Post by Radu » Fri Oct 04, 2019 8:45 am

Hi John,

Thanks for providing a possible workaround, indeed it's a decent solution on small projects.
I added your vote on the issue I opened for this request.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

jmorales
Posts: 75
Joined: Tue Oct 30, 2018 9:47 pm

Re: Searching for Text in Reused Components in Current Dita Map Hierarchy

Post by jmorales » Wed Oct 09, 2019 7:36 pm

Thanks kirkilj for the workaround suggestion, I will experiment with that approach.

rcurrington
Posts: 2
Joined: Wed Jul 28, 2021 5:00 pm

Re: Searching for Text in Reused Components in Current Dita Map Hierarchy

Post by rcurrington » Wed Jul 28, 2021 5:17 pm

Hello there, I tried "Open map in Editor with resolved topics" on a map with ~200 topics and it worked well (thank you!). However, some users in my writing community work on ditamaps with more than 200 topics. Since the last post in this thread, has any new feature been added to the "Find/Replace in Files" function to include conref'ed (embedded) content in the Current Dita Map Hierarchy? If so, could it handle a ditamap with several hundred topics?

Radu
Posts: 7579
Joined: Fri Jul 09, 2004 5:18 pm

Re: Searching for Text in Reused Components in Current Dita Map Hierarchy

Post by Radu » Thu Jul 29, 2021 6:56 am

Hi,
Since the last post in this thread, has any new feature been added to the "Find/Replace in Files" function to include conref'ed (embedded) content in the Current Dita Map Hierarchy? If so, could it handle a ditamap with several hundred topics?
The "Current Dita Map Hierarchy" means any topic or map referenced by the main DITA Map or by a submap. So indeed if a topic is referenced only by another topic, the "Current Dita Map Hierarchy" would not find content inside that.
A best practice in the industry with topics containing reusable content is to refer also to them in the DITA Maps, using the processing-role="resource-only" attribute.
For example you have a "reusables" folder with a "reusable_content.ditamap":
https://github.com/oxygenxml/DITA-Start ... /reusables

and this "reusable_content.ditamap" keeps track and references all topics containing reusable content.
The main project DITA Map in turn references the reusable_content.ditamap as resource-only:
https://github.com/oxygenxml/DITA-Start ... ct.ditamap

This makes the "Current Dita Map Hierarchy" work and also the "DITA Reusable Components" side view will start showing all reusable components in its "Components" tab.

Other than that, we do not consider the current behavior a bug. We cannot have Oxygen parse all topics (which could be thousands) just to find other indirectly referenced topics, that might take minutes or hours if the topics are located on remote servers, so Oxygen will always use the topics referenced in the DITA Maps as a scope for search and for finding reusable components.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

rcurrington
Posts: 2
Joined: Wed Jul 28, 2021 5:00 pm

Re: Searching for Text in Reused Components in Current Dita Map Hierarchy

Post by rcurrington » Thu Jul 29, 2021 7:10 pm

Radu wrote:
Thu Oct 03, 2019 8:10 am
Hi,

Thanks for the improvement request, I added an internal issue for it.

Regards,
Radu
Hi Radu,
Thanks for your prompt reply. It makes sense. I meant to ask if there was any action as a result of the internal issue. From what you have said, I will assume it resulted in no changes.

Radu
Posts: 7579
Joined: Fri Jul 09, 2004 5:18 pm

Re: Searching for Text in Reused Components in Current Dita Map Hierarchy

Post by Radu » Fri Jul 30, 2021 6:31 am

Hi,

Right, we have not done any progress on this one.
Oxygen has support for DITA master files, defining your main DITA Maps:

https://www.oxygenxml.com/doc/versions/ ... files.html

And in this case Oxygen goes through all topics and maps references in the main DITA Maps.
So one option to approach this would be the Find/Replace in Files to get another scope radio button "Find in Master Files Scope".

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply