Search for 'exact phrase'

Started by pmcabinet, March 04, 2023, 06:41:44 PM

Previous topic - Next topic

pmcabinet

I have a puzzle. I want to search the whole database for just 'Elm'; the search options are:

iMatch search problem#1.png

Now I type 'Elm' in the box; result window says no files found. So I deselect 'exact phrase', cancel the previous search and type 'Elm' in the box and the result, as expected, shows every file with that string of letters; not what I want:

iMatch search problem#2.png

The Help System states:
"If you enable the exact phrase option, only tags containing exactly the phrase tender will be found."
Why is this not working for me? Is 'Elm' not a phrase?
 
I wouldn't trouble the community, but I have spent a huge amount of time trying things out to no avail. I know the answer will be simple!


 

Mario

Your tags don't contain the phrase Elm.
They contain "Wych Elm - CPP" or "Beech woods - High Elem", judging by the screen shot. Elm is here part of the tag content.
If the tag would read "Elm", this would be an exact phrase match. Of if you would search for the exact phrase "Wych Elm - CPP".
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

sinus

I made a SHORT test, if I use

NOT Elms AND Elm

that would find Elm, but not Elms.
Best wishes from Switzerland! :-)
Markus

pmcabinet

Thank you sinus; that is an advance and rids me of 'High Elms', but doesn't eliminate '...elm...' as part of a word. Is that something I have to live with, or is it possible to refine the search even more?


And Mario, can you give me a precise definition of 'phrase'? - you seem to imply it is just another word for a tag. For instance, some of my files have a long description; is that complete description one phrase, and/or one tag? In Help/Searching, you give the example of 'tender' (a single word) as an exact phrase ("only tags containing exactly the phrase tender will be found ") which will exclude, say, 'bartender'; is 'tender' in this case a tag, or part of a tag? - how is that different from 'Elm' as an exact phrase, to exclude say 'Michaelmas' (and 'High Elms')?

You don't give the context of 'tender' in your example - is it a tag in itself, part of a description, or a keyword? Presumably that is important. I could construct a hierarchy of keywords of every tree species, Latin and English, then find Elm (if I had the time to apply these keywords retrospectively) and nothing else - not a practical method. I had hoped that a good description for each file would include all the necessary terms for precise searching. I have this trouble with Google search; it's easy to find results for a term - but very difficult to exclude what is irrelevant.

Sorry if I seem obtuse; I just need to know what is possible (and how to achieve it).

 

Mario

#4
Searching for exact phrase is rarely needed. Usually the standard "contains somewhere" is much more efficient.
There are scenarios where exact phase is useful, but they are rare.

If you search for a exact phrase, the tag value must match the exact phrase exactly (100%).

If you search for "ABC" with exact phrase mode ON,

the tag value "ABC" will match, but

"The ABC" or
"ABCD" or
"All kids learn the ABC"

will not match.

The exact phrase mode is usually only used when you need to find files with tag values matching your search term 100%.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

sinus

Then I would try 2 options:

1) "drill" down your results
Means first do a search for finding elm. Then Ctlr A (to select all founded files), and put them in another result-window (Ctrl G R)
There you can more finetuning your searches with NOT and so on ...

2) Enable Regular Expressions
I found with the expression
\belm\b
only files with Elm in my test, NOT Elms and not Goldenelm.
Means, enable Regex and this string was the short solution for me (if I did not make a mistake)

If it works not you should check out the regex-help  https://www.photools.com/help/imatch/rmh_regexp.htm

Hope, this helpes too.
Best wishes from Switzerland! :-)
Markus

Mario

#6
QuoteAnd Mario, can you give me a precise definition of 'phrase'? - you seem to imply it is just another word for a tag.
Yes. IMatch searches the selected or all tags for the search term / phrase / word you enter in the File Window search box.


Quoteis 'tender' in this case a tag, or part of a tag? - how is that different from 'Elm' as an exact phrase, to exclude say 'Michaelmas' (and 'High Elms')?

If you search for the exact phrase "tender" but the tag has the content "Bartender", it will not match your phrase.

If you search for the exact phrase "Elm" but the tag has the value "High Elms" it will not match. It would neither match "Elms" or "High" as long as you search for the exact phrase. Only the search term "High Elms" will match the tag value "High Elms" when exact phrase is on.


QuoteI had hoped that a good description for each file would include all the necessary terms for precise searching. I have this trouble with Google search; it's easy to find results for a term - but very difficult to exclude what is irrelevant.

This depends on how you use Google search (e.g., the advanced search operators) or the IMatch search, which also offers advanced functions like regular expressions.

When I understand you correctly you want to find all files where the term "Elm" appears somewhere in the description, but not "Elms" or "High Elms" or "Michaelmas"?

As sinus pointed out above, such more complex searches are best done using Regular Expressions
If you enable regular expressions and use \b to indicate a word boundary, you get what you want:

\belm\b

Using only \belm or elm\b you can also find descriptions containing words starting with elm or ending with elm.

Checkout the help topic I've linked to above and use the RegExp Tester app included in IMatch to learn a bit about regular expressions. They are very powerful, especially for somebody with very specific search requirements.

Ps.: You could make IMatch create a data-driven category from your descriptions, using a blank and maybe . for splitting the description into words. This would give you a category for "Elm" and one for "Elms" and one for "Eillems" and all other words you have used in your descriptions. Might avoid a lot of searching.
Unless you have used too many different words in your description, which would make this probably futile.
Worth a try, though.

That's why (hierarchical) keywords are so important.

Especially if you work with taxonomies, a good vocabulary in the IMatch Universal Thesaurus goes a long way for and quickly consistently adding keywords to your images. Which then automatically organizes your files via the @Keywords Category and avoids most searches.

Let us know if you need additional assistance. In that case, specific precisely what you want to find and provide some of the tag values you want to search.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

pmcabinet

Thanks to both sinus and yourself Mario. You have given me good stuff to work on and I much appreciate your time. Excellent support.