On well written searches...

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

On well written searches...

Post by Marco »

Today I entered the world Multi Field Search for the first time. I wanted to replicate (and extend) the action "Find All" and "In This Branch" of button "Find by Label" in a comfortable Catalog item.
The search performed via the button is extremely fast, since it just involves scanning a text file (on my system it takes 90 ms for 160 items).
In the Catalog I placed this line:

Code: Select all

?:lbl:?* and name:* /r
and everything worked as expected, thanks to the insight provided in the release notes ( http://www.xyplorer.com/xyfc/viewtopic. ... 220#p69366 ).

Now, what if I wanted to make it more general and consider tags and comments too, yet mantaining this speed performance?
I basically want to retrieve every object with a label OR a comment OR a tag in the current path and all the subfolders.
The following don't do the trick, since going to My Computer (so to catch everything) and running the search triggered the classical slow folder scan:

Code: Select all

?:lbl:?* and name:* or tags:?* or cmt:?* /r
?:(lbl:?* and name:*) or (tags:?* and name:*) or (cmt:?* and name:*) /r
Any ideas?
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

admin
Site Admin
Posts: 66365
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: On well written searches...

Post by admin »

It's not easy to determine when a fast database search is possible. The current decision-making was lacking. The next version should work better. All these examples will then apply the fast database search:

Code: Select all

*?:lbl:?* /r
*?:lbl:?* or tags:?* or cmt:?* /r
*?:lbl:?* and name:a* or tags:?* and name:a* or cmt:?* and name:a* /r
*?:(lbl:?* or tags:?* or cmt:?*) and name:a* /r

Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Re: On well written searches...

Post by Marco »

It comes to my mind that this (determine if a search can be "fast") is a propositional logic problem.
Can you tell me what boolean operators are supported? I have an idea...
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

admin
Site Admin
Posts: 66365
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: On well written searches...

Post by admin »

Marco wrote:It comes to my mind that this (determine if a search can be "fast") is a propositional logic problem.
Can you tell me what boolean operators are supported? I have an idea...
Or, And, Not

Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Re: On well written searches...

Post by Marco »

Well, I come (late) with a simple (I suppose) solution.

Search supports the fields lbl, tags, cmt (let's call them DB, from DataBase), name, len, lent, prop (let's call these FS, from FileSystem).
The behaviour should be the one in the image, e.g. combining a field of the DB group and a field from the FS with the AND operator should trigger a search which starts from the DB. The NOT operator doesn't change anything.
If you look closely and replace DB with 0 and FS with 1 you'll see that the two table are in fact the truth tables of their logical operator.

So to determine whether a search will be faster because will start from the tags database you just need to:
- strip the search terms leaving only the seven fields above;
- giving the DB fields value 0 and the FS fields value 1;
- evaluate the obtained expression: if the result is 0 then the search will be fast.

Anyway compliments to you because you found the solution way faster!
To see the attached files, you need to log into the forum.
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

admin
Site Admin
Posts: 66365
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: On well written searches...

Post by admin »

Thanks for the thinking!

But I don't really understand your tables. :|

Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Re: On well written searches...

Post by Marco »

They are classic double entry tables. Maybe these are clearer...
To see the attached files, you need to log into the forum.
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

admin
Site Admin
Posts: 66365
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: On well written searches...

Post by admin »

Ah, got it, thanks. Never heard of "double entry tables" before. I'm just a guitarist that teached himself programming.

Post Reply