Searching content with quote and equals symbols

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
••••
Posts: 4
Joined: Fri Apr 19, 2019 12:07 pm

Searching content with quote and equals symbols

Post by •••• »

Hello, I would like to find all files which have exactly this content:

Code: Select all

android:shape="ring"
So far I was only able to search for files which have content "ring"

Code: Select all

*.xml drawable\ content:ring
This was almost perfect but as I result I got elements like "ovalring" or "ringabc".

I would like to get content with exactly this content "ring" (including quotes).

Somehow when I add equals with quote symbol, whole query fails and retuns 0 results.

Code: Select all

*.xml drawable\ content:="ring
or when I add

Code: Select all

*.xml drawable\ content:"="ring"
It looks like Everything can not parse this equals symbol.

How could I solve this?
NotNull
Posts: 5167
Joined: Wed May 24, 2017 9:22 pm

Re: Searching content with quote and equals symbols

Post by NotNull »

You need a macro for special characters

In this case it's not the = that causes 'trouble', but the double quotes. Rplacing " with "quot:" should give you what you want:

Code: Select all

drawable\ ext:xml  content:"android:shape="quot:"ring"quot:"" 

(you need the "" around quot: to separate it from other search text; otherwise Everything would search for - amongst other thyings - ringquot: )
NotNull
Posts: 5167
Joined: Wed May 24, 2017 9:22 pm

Re: Searching content with quote and equals symbols

Post by NotNull »

BTW, I just discovered an easier way:
  • Go to Menu:Search > Advanced Search
  • Fill in
    android:shape="ring"
    in the A word or phrase in the file: box
  • Add other criteria, like folder to search in (Located in:) and file extension (Extension:)
  • Press the OK button
Everything will automagically convert your android:.... to the "quot:" syntax.

This program keeps amazing me! :o
••••
Posts: 4
Joined: Fri Apr 19, 2019 12:07 pm

Re: Searching content with quote and equals symbols

Post by •••• »

Thanks but this still doesn't work:

Code: Select all

ext:xml drawable\ content:"android:shape="quot:"ring"quot:""
However this two work:

Code: Select all

ext:xml drawable\ content:"shape"

Code: Select all

ext:xml drawable\ content:"ring"
I've noticed strange behaviour here. Query below works well:

Code: Select all

ext:xml drawable\ content:"android:"
But it stops working when I add "shape" word:

Code: Select all

ext:xml drawable\ content:"android:shape"
Here is sample text in xml file:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="ring">
            <solid android:color="@color/light_divider_shape_bg" />
        </shape>
    </item>
    <item>
        <inset
            android:insetBottom="16dp"
            android:insetLeft="16dp"
            android:insetRight="16dp"
            android:insetTop="16dp">
            <shape
                android:shape="rectangle"
                android:useLevel="false">
                <solid android:color="@color/light_divider_shape_line" />
                <size
                    android:width="1dp"
                    android:height="1dp" />
            </shape>
        </inset>
    </item>

</layer-list>
----

I didn't noticed post before - let me check it..
Nope, still doesn't work. Maybe this "android:" is interpreted by Everything as a macro object..
NotNull
Posts: 5167
Joined: Wed May 24, 2017 9:22 pm

Re: Searching content with quote and equals symbols

Post by NotNull »

This is what happens on my system (Everything 1.4.1.935 x64 @ Win10):
2019-04-19 19_31_31-t_ ext_txt  content__android_shape=_quot__ring_quot___  - Everything.png
2019-04-19 19_31_31-t_ ext_txt content__android_shape=_quot__ring_quot___ - Everything.png (29.61 KiB) Viewed 5129 times

Please check Menu:Search. The only enabled entry should be Everything (no Match Path, etc)
••••
Posts: 4
Joined: Fri Apr 19, 2019 12:07 pm

Re: Searching content with quote and equals symbols

Post by •••• »

Here is my query:
ev_1.png
ev_1.png (160.29 KiB) Viewed 5128 times
Here is Your query:
ev_2.png
ev_2.png (9.59 KiB) Viewed 5113 times
Last edited by •••• on Sat Apr 20, 2019 9:50 am, edited 1 time in total.
NotNull
Posts: 5167
Joined: Wed May 24, 2017 9:22 pm

Re: Searching content with quote and equals symbols

Post by NotNull »

Hmm ... strange ....

I changed my line endings to LF (was: CR/LF), just like you had (see Notepad++ statusbar). The text can still be found.

Do you get results if you replace content: with utf8content: ?
Other that that I have no inspiring ideas at the moment (= late at night).


BTW: With Alt-P (Menu:View > Preview) you can toggle the Preview Pane (but I'm glad you didn't, otherwise I would have missed the LF line ending)
••••
Posts: 4
Joined: Fri Apr 19, 2019 12:07 pm

Re: Searching content with quote and equals symbols

Post by •••• »

Correct, utf8 was the case. Thank You.

Correct query:

Code: Select all

ext:xml drawable\ utf8content:"android:shape="quot:"ring"quot:"" 
NotNull
Posts: 5167
Joined: Wed May 24, 2017 9:22 pm

Re: Searching content with quote and equals symbols

Post by NotNull »

That's good news! Glad this works for you.


@void: I don't understand why utf8content: was necessary. If the .xml iFilter isn't available, Everything falls back on utf8conent: ?

(or could this be caused by using a 'wrong' iFilter, let's say a .xls one? )
void
Developer
Posts: 15098
Joined: Fri Oct 16, 2009 11:31 pm

Re: Searching content with quote and equals symbols

Post by void »

The default xml iFilter only reads element text and attribute text, it ignores tag text and surrounding quotes are removed.

Using the utf8content: search function will force Everything to use its built-in UTF-8 content search, which basically loads the entire file into memory and does a UTF-8 strstr search. This will only work if the xml is UTF-8.

The question is now should Everything override the default iFilter for xml files and use utf8content: when the source xml file is utf8?
NotNull
Posts: 5167
Joined: Wed May 24, 2017 9:22 pm

Re: Searching content with quote and equals symbols

Post by NotNull »

That's a very good question ...

After giving it some thought. I think Everything should keep using the current .xml iFilter although it is rather dysfunctional (you can search for key, you can search for value but not key=value )

Reasons why:
  • .XML files can get quite large (multiple GB's) and loading them in RAM completely using utf8content: might cause new challenges.
  • the current XML iFilter might get an update, adding the missing functionality.
  • The few times this might cause an issue, it will be asked on the forum and we can advice accordingly.
But: If it's technically possible, I think using the text iFilter (.txt) for XML files instead might be a nice workaround.


Now I only have to figure out why it works on my systems ... (probably because I reconfigured some file extensions/ iFilters)
void
Developer
Posts: 15098
Joined: Fri Oct 16, 2009 11:31 pm

Re: Searching content with quote and equals symbols

Post by void »

.XML files can get quite large (multiple GB's) and loading them in RAM completely using utf8content: might cause new challenges.
Currently it is much worse than that, Everything will load the entire file into a memory stream for the iFilter, then the iFilter reads chunks as Wide Chars, which is then copied to a single large UTF-8 buffer for the search to execute. This could end up using 4 times the size of the original file in memory.

iFilters are designed more for indexing (removes formatting and styling), whereas Everything is more interested in searching files as raw text.
I would prefer the ability to search xml files for key="value" as your would perform a search in a text editor, so I am investigating an option to override some ifilters (txt,html and xml) for performance reasons, accuracy and consistency.

I'll add an ifilter-content: search to so the user can specify ifilter content searches only.
NotNull
Posts: 5167
Joined: Wed May 24, 2017 9:22 pm

Re: Searching content with quote and equals symbols

Post by NotNull »

In that case: please add .json files to that list too (although there is currently no default iFilter for those, meaning that it will fall back on utf8content: already)

And another suggestion : use content:'searchstring' for literal text (using single quotes). That way one has less escaping to do (" " is more common than ' '):
content: ' android:shape="ring" ' (extra spaces added for clarity)
Post Reply