Opened 12 months ago

Closed 4 months ago

#18672 closed bug (fixed)

different query results depending on the order of the expression

Reported by: augiedoggie Owned by: nobody
Priority: normal Milestone: R1/beta5
Component: Kits/Storage Kit Version: R1/beta4
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description (last modified by augiedoggie)

queries in Haiku seem to require the name part of the expression to come first. For example, this works:

query -a '((name=="**")&&(BEOS:TYPE=="application/x-vnd.Be-elfexecutable"))'

but this doesn't:

query -a '((BEOS:TYPE=="application/x-vnd.Be-elfexecutable")&&(name="**"))'

I came across this problem while working on some of the old BeSampleCode at HaikuArchives. I don't have BeOS installed to test but I assume the old code worked.

On a related note, I thought you could execute a query in BeOS without a name but that doesn't seem to work. Maybe I'm not remembering it properly. Like:

query -a '(BEOS:TYPE=="application/x-vnd.Be-elfexecutable")'

Change History (5)

comment:1 by augiedoggie, 12 months ago

Description: modified (diff)

comment:2 by bipolar, 12 months ago

This one drove me nuts some months ago, while testing to see if I could make Pe's BeBookFetch extension work again (even if I had to come up with a custom "Be Book's Bookmarks" zip/package).

(augiedoggie might remember trying to help me, over IRC, to make sense of the issue)

That extension also uses "name" *after* "BEOS:TYPE", and I couldn't really understand why it didn't worked (not an unusual state of mind for me, but... :-P).

comment:3 by bipolar, 12 months ago

I've just tested on a VM with a LiveCD of "BeOS Max Edition" I had lying around.

Both:

query -a '((name=="**")&&(BEOS:TYPE=="application/x-vnd.Be-elfexecutable"))'

and

query -a '((BEOS:TYPE=="application/x-vnd.Be-elfexecutable")&&(name="**"))'

give the exact same results.

While "query without name", ie: query -a '(BEOS:TYPE=="application/x-vnd.Be-elfexecutable")' yields no results.

Trying to use Tracker's Find in "formula mode" with only (BEOS:TYPE=="application/x-vnd.Be-elfexecutable"), just closes the Find window upon hitting enter (on Haiku it shows a query window with no results at least).

Last edited 12 months ago by bipolar (previous) (diff)

comment:4 by madmax, 12 months ago

It would seem we bail out somewhere if there's no index. The query still works if you use any other indexed attribute instead of name, and it also works with just the type search if that is indexed.

comment:5 by waddlesplash, 4 months ago

Milestone: UnscheduledR1/beta5
Resolution: fixed
Status: newclosed

Fixed in hrev57797. It is actually possible to run queries without an index, but you have to specify B_QUERY_NON_INDEXED (or, as in this ticket, insert a term that references an index.)

Note: See TracTickets for help on using tickets.