Jump to content

Searching for a document containing specific text


Recommended Posts

Hi, I'm having trouble finding affinity publisher documents on my Mac.  For example, I may know that the document I want contains the phrase  'where the blue mountains rise' ... but unless this phrase is in the title of the document it doesn't come up in a search with finder -  and if I can't remember the title, or where it is filed then I'm jinxed.  Any ideas?

Link to comment
Share on other sites

5 hours ago, HalfMoon said:

Hi, I'm having trouble finding affinity publisher documents on my Mac.  For example, I may know that the document I want contains the phrase  'where the blue mountains rise' ... but unless this phrase is in the title of the document it doesn't come up in a search with finder -  and if I can't remember the title, or where it is filed then I'm jinxed.  Any ideas?

Hi and welcome to the forums. I don't believe there is a way to do this because macOS doesn't have access to the text in the document.

Link to comment
Share on other sites

34 minutes ago, MikeTO said:

Hi and welcome to the forums. I don't believe there is a way to do this because macOS doesn't have access to the text in the document.

Many thanks MikeTO.  I used to work with Serif PagePlus in windows and very frequently made this kind of search with no problem.  Also, Mac is able to find pdf files that have specified text in the document - is there any way to give Mac access to the text in affinity documents?  Sorry if that is more of a Mac question than and affinity question?!

Link to comment
Share on other sites

3 minutes ago, HalfMoon said:

is there any way to give Mac access to the text in affinity documents?

From what I've seen looking at the internals of the Affinity files, the "text" is not present in any way that any other programs can understand.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
    Laptop 2: Windows 11 Pro 24H2,  16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU
iPad:  iPad Pro M1, 12.9": iPadOS 18.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.0.1

Link to comment
Share on other sites

Just now, LondonSquirrel said:

You may have some luck from the command line. Open a terminal and type:

egrep 'where the blue mountains rise' *.afpub

You may see the result 'Binary file <filename> matches.

If that doesn't work above, try egrep mountains *.afpub.

I see no recognizable text in an Affinity document when I examine it with a hex editor.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
    Laptop 2: Windows 11 Pro 24H2,  16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU
iPad:  iPad Pro M1, 12.9": iPadOS 18.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.0.1

Link to comment
Share on other sites

52 minutes ago, HalfMoon said:

is there any way to give Mac access to the text in affinity documents?

Affinity should provide a Spotlight importer plugin, a small piece of software that could interpret the content of these files and report it to the macOS search engine but they don't. 

• https://eclecticlight.co/2021/01/28/spotlight-on-search-how-spotlight-works/

Hereby is a list of all the .mdimporter files on my Mac; there is none from Affinity:

Spoiler

mdimport -L

Paths: id(501) (

    "/System/Library/Spotlight/SystemPrefs.mdimporter",

    "/System/Library/Spotlight/iWork.mdimporter",

    "/System/Library/Spotlight/iPhoto.mdimporter",

    "/System/Library/Spotlight/PDF.mdimporter",

    "/System/Library/Spotlight/RichText.mdimporter",

    "/System/Library/Spotlight/Office.mdimporter",

    "/System/Library/Spotlight/PS.mdimporter",

    "/System/Library/Spotlight/MIDI.mdimporter",

    "/System/Library/Spotlight/Archives.mdimporter",

    "/System/Library/Spotlight/Audio.mdimporter",

    "/System/Library/Spotlight/iPhoto8.mdimporter",

    "/System/Library/Spotlight/Automator.mdimporter",

    "/System/Library/Spotlight/Application.mdimporter",

    "/System/Library/Spotlight/Font.mdimporter",

    "/System/Library/Spotlight/Mail.mdimporter",

    "/System/Library/Spotlight/vCard.mdimporter",

    "/System/Library/Spotlight/Image.mdimporter",

    "/System/Library/Spotlight/iCal.mdimporter",

    "/System/Library/Spotlight/CoreMedia.mdimporter",

    "/Library/Spotlight/iBooksAuthor.mdimporter",

    "/Applications/LibreOffice.app/Contents/Library/Spotlight/OOoSpotlightImporter.mdimporter",

    "/Applications/GarageBand.app/Contents/Library/Spotlight/GarageBandSpotlightImporter.mdimporter",

    "/Applications/GarageBand.app/Contents/Library/Spotlight/LogicX_MDImport.mdimporter",

    "/Applications/Utilities/EtreCheckPro.app/Contents/Library/Spotlight/EtreCheckPro.mdimporter",

    "/Applications/\U2022 Utilitaires perso/UnicodeChecker.app/Contents/Library/Spotlight/UCCharacter.mdimporter"

)

BTW, you could post a request in the Feedback section of these forums to ask for such an importer to be included in a future version… 

Affinity Suite 2.5 – Monterey 12.7.5 – MacBookPro 14" 2021 M1 Pro 16Go/1To

I apologise for any approximations in my English. It is not my mother tongue.

Link to comment
Share on other sites

4 hours ago, Oufti said:

Affinity should provide a Spotlight importer plugin, a small piece of software that could interpret the content of these files and report it to the macOS search engine but they don't. 

They could also provide a QuickLook plugin that would enable better previews, but they don't. Sadly, I've come to accept that Affinity files are simply blackboxes that are largely invisible to the operating system, which then requires the user (ahem, me) to add 'metadata/files' (such as the Word doc that was imported, Finder metadata, readme files, preview.jpgs/pdfs, etc) around the files in hope of making them a little less… obscure obtuse.

image.jpeg.d700264916745e76bb535c6a3a284ebc.jpeg

Link to comment
Share on other sites

42 minutes ago, LondonSquirrel said:

You may have some luck from the command line. Open a terminal and type:

egrep 'where the blue mountains rise' *.afpub

You may see the result 'Binary file <filename> matches.

If that doesn't work above, try egrep mountains *.afpub.

 

In both cases you need to be in the directory where the afpub files are located, or add the full path before the file names.

Thanks - it comes up with zsh: no matches found .... but I haven't figured out how to 'be in the directory' ... (I am not techy!)   May need to sleep on it and come back later!

 

Link to comment
Share on other sites

3 hours ago, HalfMoon said:

I haven't figured out how to 'be in the directory' ...

in the Terminal, you can type cd,  followed by a space character, then drag and drop into the Terminal's window the icon of the folder. This will include the path for the folder. Last, press Enter/Return to validate. 

Affinity Suite 2.5 – Monterey 12.7.5 – MacBookPro 14" 2021 M1 Pro 16Go/1To

I apologise for any approximations in my English. It is not my mother tongue.

Link to comment
Share on other sites

4 hours ago, LondonSquirrel said:

That's because grep/egrep is not looking in the same way. Try it with a test file.

I know how grep and egrep work; they find plain text, assuming it's present.

It's not present in Affinity files, and I have tried them with .afpub and they find nothing (just as I found nothing manually looking inside the files).

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
    Laptop 2: Windows 11 Pro 24H2,  16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU
iPad:  iPad Pro M1, 12.9": iPadOS 18.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.0.1

Link to comment
Share on other sites

1 hour ago, LondonSquirrel said:

Meanwhile they work for me. 

Then I think you got lucky. 

And yes, they find patterns, but in the text, which would also be visible using a plain or hex text editor.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
    Laptop 2: Windows 11 Pro 24H2,  16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU
iPad:  iPad Pro M1, 12.9": iPadOS 18.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.0.1

Link to comment
Share on other sites

8 hours ago, LondonSquirrel said:

You may have some luck from the command line. Open a terminal and type:

egrep 'where the blue mountains rise' *.afpub

You may see the result 'Binary file <filename> matches.

If that doesn't work above, try egrep mountains *.afpub.

 

In both cases you need to be in the directory where the afpub files are located, or add the full path before the file names.

FWIW, I tried the above with this dead simple will it egrep?.afpub file but zsh does not find the egrep command, so like in your later example I used grep instead of egrep ... & still could get no matches. 

All 3 1.10.8, & all 3 V2.5.5 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
A
ll 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
Share on other sites

The .af* files would have to contain the text in open form. Perhaps this could be a suggestion for developers to add an option to applications to "Save indexable text with the file", after which the application would traverse all text fields and other specified text and save it to a file.

Link to comment
Share on other sites

13 minutes ago, HalfMoon said:

Where / how can suggestion be made to developers?

You can post there: https://forum.affinity.serif.com/index.php?/forum/122-feedback-for-the-affinity-v2-suite-of-products/

Affinity Suite 2.5 – Monterey 12.7.5 – MacBookPro 14" 2021 M1 Pro 16Go/1To

I apologise for any approximations in my English. It is not my mother tongue.

Link to comment
Share on other sites

13 hours ago, walt.farrell said:

I know how grep and egrep work; they find plain text, assuming it's present.

It's not present in Affinity files, and I have tried them with .afpub and they find nothing (just as I found nothing manually looking inside the files).

That's right, for the proprietary Affinity file format, the text is also stored in a compressed binary manner, so in sections of BLOBS instead of directly readable/matchable UTF-8 chunks. - So trying to read and find matching text portions inside of APub files, via common tools (like e/grep and bbe etc.) won't work here.

Also most file parsing attempts (those I just know of) ...

... will give you at best just some binary blobs back and thus are of no real use here.

☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan
☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2

Link to comment
Share on other sites

1 minute ago, LondonSquirrel said:

Except on at least one example, as above, it did work.

Which one? - Then you may share your example for some inspection.

☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan
☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2

Link to comment
Share on other sites

19 minutes ago, LondonSquirrel said:

I did above. That was the output of the command. I'm not going to share the file as it has limited circulation.

Can you reproduce the success in a file that you can share?

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
    Laptop 2: Windows 11 Pro 24H2,  16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU
iPad:  iPad Pro M1, 12.9": iPadOS 18.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.0.1

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.