Author Topic: Search From Anywhere Script  (Read 4021 times)

Ferdinand

  • 100 years since I was shot and a war was started
  • Global Moderator
  • *****
  • Posts: 1670
Search From Anywhere Script
« on: August 11, 2015, 02:17:19 PM »
The search bar above the file window is pretty powerful.  But sometimes the fact that it operates on the current context (what's in the file window) can be a drawback.  If you want to search the entire DB then you have to change the context to @All in Categories View, or the Database node in Media and Folders View.  I.e. it takes time to switch and you lose your place. 

This script provides all the functionality of the search bar, but allows you to change the context for the search without changing the current context, i.e. without losing your place.  The search results are listed in a new seach results tab / view.

Note that this script with lock IMatch while it's underway and can't be cancelled.   I don't think there's a way around that.  Some searches can take a while, e.g. if you specify to search in all fields across the entire DB.  You have been  warned.

There is some blank space in the script dialog.  There are some additional options that I may include later depending on interest, like specifying which fields to search in via a filter, and limiting the number of results.

Thank you to Mario for providing SetScope, GetScope and ClearScope in 5.4.10, which enabled this script to be written with these options.

[attachment deleted by admin]

ColinIM

  • Sr. Member
  • **
  • Posts: 345
  • IMatch User since v1.22 (1999)
Re: Search From Anywhere Script
« Reply #1 on: August 11, 2015, 02:37:39 PM »
Thank you Ferdinand.
Another useful addition to our Search options.
Colin P.
Colin P.
I feed my IMatch using: DxO PhotoLab | Nikon Capture NX2 | Vuescan | PanoramaStudio 3
(I live in the UK but my body-clock is stuck somewhere in the USA)

guentergulasch

  • New Members
  • *
  • Posts: 13
Re: Search From Anywhere Script
« Reply #2 on: August 20, 2015, 07:29:48 PM »
Thanks from me too, Ferdinand, for this useful script.

I'm not quite sure what "Standard Scope" in the "Which Fields?" diaogue means, but the script works perfectly. So far it's found everything I wanted to look for.

Cheers
Andreas


Ferdinand

  • 100 years since I was shot and a war was started
  • Global Moderator
  • *****
  • Posts: 1670
Re: Search From Anywhere Script
« Reply #3 on: August 21, 2015, 09:30:38 AM »
I'm not quite sure what "Standard Scope" in the "Which Fields?" diaogue means, but the script works perfectly.

Fair point.  I was guilty of putting this together in a bit of a rush, and in so doing I just used the terminology from the scripting help, which says: "Searches all metadata from the standard scope. This improves the search speed considerably and covers the most frequently used tags."  I assume that this is the same as "Limit search to frequently use tags (faster)" in the search bar options. 

I'll probably add a few extra options at some point and will make this particular option clearer when I do.

DigPeter

  • Super Hero
  • ****
  • Posts: 1219
Re: Search From Anywhere Script
« Reply #4 on: August 31, 2015, 12:46:28 PM »
Ferdinand, I have tried this and find it is useful. Thanks for sharing it. I understand that you have ideas for further development.  One suggestion is that a choice of options is provided to limit the search to specific parts of a field, as in MSOffice:  e.g. anywhere in field, whole field, start of field.  As an example, I was searching for a file name 0_002.jpg - 'jpg' was ignored and all files with names that included 0_002 were found.

But,as I say, a useful facility.

Ferdinand

  • 100 years since I was shot and a war was started
  • Global Moderator
  • *****
  • Posts: 1670
Re: Search From Anywhere Script
« Reply #5 on: August 31, 2015, 02:50:02 PM »
I'll keep this in mind Peter, but don't hold your breath.  Actually I am not sure I can do this.  I am using the SearchEngine Class scripting methods, and I can't quickly see the ability to do this.  There are options for filters on the tag and tag group, but this is not like regex where you can do some quite sophisticated matching of patterns.  I'll check, in due course.  In the fullness of time ....

DigPeter

  • Super Hero
  • ****
  • Posts: 1219
Re: Search From Anywhere Script
« Reply #6 on: August 31, 2015, 03:06:06 PM »
I'll keep this in mind Peter, but don't hold your breath.  Actually I am not sure I can do this.  I am using the SearchEngine Class scripting methods, and I can't quickly see the ability to do this.  There are options for filters on the tag and tag group, but this is not like regex where you can do some quite sophisticated matching of patterns.  I'll check, in due course.  In the fullness of time ....
Fine - whenever.

Aubrey

  • Super Hero
  • ****
  • Posts: 1214
  • IMatch user since June 2008
Re: Search From Anywhere Script
« Reply #7 on: December 21, 2016, 05:01:42 PM »
Ferdinand,
I didn't know this existed until I read another thread today.
I have installed it, I think it will be useful.

Aubrey