Pages: [1]   Go Down

Author Topic: Keyword Order  (Read 3993 times)

Rendezvous

  • Jr. Member
  • **
  • Offline Offline
  • Posts: 91
    • Daniel Talbot Photo Blog
Keyword Order
« on: June 12, 2012, 03:03:11 am »

Looking through my keyword list I came across this part, which is a list of aircraft type codes (yeah, I'm a plane spotter). Any idea why Lightroom has sorted B77W above something such as B733? Surely 73 comes before 77?

Peter Stacey

  • Full Member
  • ***
  • Offline Offline
  • Posts: 156
Re: Keyword Order
« Reply #1 on: June 12, 2012, 03:09:03 am »

I'm sure Jeff will have the most definitive answer, but in looking at that list, it looks as though Lightroom compares the whole int value, not iterating through each individual digit.

So 77 < 733

Just a guess though.

Regards,

Peter
« Last Edit: June 12, 2012, 03:15:54 am by Peter Stacey »
Logged
[img width=80 height=11]http://peterstac

Peter Thomson

  • Newbie
  • *
  • Offline Offline
  • Posts: 5
Re: Keyword Order
« Reply #2 on: June 12, 2012, 04:14:20 am »

& 74<77
Logged

Tony Jay

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2965
Re: Keyword Order
« Reply #3 on: June 12, 2012, 04:31:01 am »

The answer is all in character sets and how they are interpreted.
All characters are numbered codes.
Letters come before numbers.

Regards

Tony Jay
Logged

Rendezvous

  • Jr. Member
  • **
  • Offline Offline
  • Posts: 91
    • Daniel Talbot Photo Blog
Re: Keyword Order
« Reply #4 on: October 10, 2012, 07:56:24 pm »

Surely  "B73..." would still come before "B77...." regardless of what the fourth character is?

aduke

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 446
Re: Keyword Order
« Reply #5 on: October 10, 2012, 10:21:10 pm »

The answer is all in character sets and how they are interpreted.
All characters are numbered codes.
Letters come before numbers.

Regards

Tony Jay

Actually, in the Ansi code scheme, the numbers have lower code values than the lower-case letters which have lower code values than the upper-case letters. The keyboard special characters are interspersed throughout the sequence.

Alan
Logged

jeremypayne

  • Guest
Re: Keyword Order
« Reply #6 on: October 10, 2012, 10:58:33 pm »

This is one of those 'things' you can literally spend days discussing with developers.



Logged

Tony Jay

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2965
Re: Keyword Order
« Reply #7 on: October 11, 2012, 05:37:12 am »

Actually, in the Ansi code scheme, the numbers have lower code values than the lower-case letters which have lower code values than the upper-case letters. The keyboard special characters are interspersed throughout the sequence.

Actually Lr uses Unicode not ASCII but the general principle is correct.

The issue revolves around how Lr (the SQLite database in fact) "perceives" STRINGS of characters rather than individual characters.
If B733 is perceived as B-733 (ie 733 as a number) or B-7-3-3 (each character treated separately) it changes how it is parsed when compared to B77.
In the first case B77 will be placed before B733 and in the second case B733 will come before B77.

I am in the process of investigating exactly how alphanumeric strings are handled in Lightroom (as opposed to pure alphabetical strings or pure numeric strings). When I know the answer I will report back.

Regards

Tony Jay
Logged

Rhossydd

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 3369
    • http://www.paulholman.com
Re: Keyword Order
« Reply #8 on: October 11, 2012, 05:52:58 am »

Surely  "B73..." would still come before "B77...." regardless of what the fourth character is?
Why would you ever ignore the digits in a mathematical sequence ?
It seems obvious that seventy three would always be before seven hundred and anything in an ascending sequence.
Logged

Tony Jay

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2965
Re: Keyword Order
« Reply #9 on: October 11, 2012, 09:51:38 pm »

I have done an extensive search on the web for an answer to this question.
Apart from very technical articles dealing with Unicode that are almost completely inpenetrable there is not a lot to find.

So, going back to Lightroom itself it is very clear that consecutive numeric characters in keywords are interpreted by Lightroom as a number and not as two consecutive Unicode characters that happen to be numeric characters.
Thus, B77 is interpreted as B-77 and B733 is interpreted as B-733.
Therefore as numbers 77 < 733 and so 77 precedes 733 in keyword order.
The B in front of the numeric characters does not change the observed behaviour.

I am not sure if this behaviour is a default of Unicode itself, default behaviour in SQLite, or behaviour specifically programmed into SQLite by the Adobe Lightroom engineers.
I have not found any information on the web that appears to answer this question but I also readily admit that I know next-to-nothing about SQL datadase programming and as previously stated the technical information about Unicode that I uncovered may as well have been in Mandarin for all the enlightenment it gave me.

One individual, that I am aware of, who may have some insight on this issue that frequents LuLa forums is John Beadsworth.

Regards

Tony Jay
Logged

john beardsworth

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 4755
    • My photography site
Re: Keyword Order
« Reply #10 on: October 12, 2012, 01:54:29 am »

I'm pretty certain it's not SQL. My guess is after getting the raw data from the database, two or three things are going on in the Lua code. There's certainly code which breaks up data into individual words (see the smart collection criteria "contains words"), so with keywords there's probably code that breaks out consecutive numerical characters and treats them as another column for sorting. In the original example, B77W comes above B733 because it's sorting first by the initial letter, then on the number. I can imagine circumstances where this would produce a "wrong" order, but plenty where it's surprisingly clever.

Logged

Tony Jay

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2965
Re: Keyword Order
« Reply #11 on: October 12, 2012, 02:28:39 am »

Thanks John - that was my thought too but just no way of proving it.

(BTW apologies for the missing 'r' in your surname.)

Regards

Tony Jay
Logged

Rendezvous

  • Jr. Member
  • **
  • Offline Offline
  • Posts: 91
    • Daniel Talbot Photo Blog
Re: Keyword Order
« Reply #12 on: October 13, 2012, 04:06:09 am »

Thanks for the replies - quite interesting. Of course, it doesn't really matter as long as I can search for the keywords, which I can.
Pages: [1]   Go Up