Skip to Content
Register · Login
About Theme

A Letterboxing Community

Atlas Quest
Search Edit Search

Read Thread: top search results show exact box name match

top search results show exact box name match
Board: Suggestion Box
Apr 15, 2018 12:44pm
Thread (disabled) Board
I was just wondering ... if it would be possible to reconfigure the AQ "search engine" in such a way that if one spells the name of a box exactly correctly it appears at the top of the search. Maybe there is a way to do this already?

For example, I searched for a box called "Liberty." No other words. That was just the name. I did a Basic Letterbox Search using the widget, a Simple Search, and an Advanced Search and the box I was looking for was waaaaay down the list at #206.

And worse than that was a box called "Ice Cream," which came in 420th on my search list.

So I was wondering if the AQ searches could be made to put exact spelling matches first. Or maybe if the Advanced Search had a "Use exact name" like it has "Use exact locations."

I totally understand if that is not feasible, but I thought I'd ask. :-)
Re: top search results show exact box name match
Board: Suggestion Box
Reply to: #959152 by roo
Apr 15, 2018 4:53pm
Thread (disabled) Board
So I was wondering if the AQ searches could be made to put exact spelling matches first. Or maybe if the Advanced Search had a "Use exact name" like it has "Use exact locations."

It kind of does have that feature already.... if you hack the URL to include a parameters called "exactName=liberty" (for instance). It'll only return boxes that start with the word liberty. Not necessarily an "exact" match in the strictest sense of the word since it returns all boxes that begin with the word rather than all boxes with just that word, but it's probably sufficient for your purposes.

The boxes are sorted alphabetically by default, though, so (usually) the one-word exact matches you're looking for will be a the top of the search results. Usually? Well... yes... the one caveat to watch out for is when you search for a series, the names of the individual boxes in a series are appended to the series name internally in AQ, and it's actually sorting on that. So if the box is part of a series, it'll be sorted based as if the full name was the series name plus the first (unseen) box name.

It's one of those little known, unpublished features, but it does actually work. =)

But I realize that most people aren't into URL hacking, so I've quickly added a hack that if you type the box name and the first character is a ^ symbol, it'll convert it into an "exact name" search.

So if you search for liberty, it'll return all boxes (including individual boxes within a larger series) that have that word in the name.

But if you search for ^liberty, it'll return only boxes that start with that word.

Also--when you're looking for the proverbial needle in a haystack--you can also narrow down your search results. Ice cream might have been #420 on your list, but if you searched for a box named "ice cream" within 30 miles of your location, I bet the list would be considerably shorter! =)

Happy trails!

-- Ryan
Re: top search results show exact box name match
Board: Suggestion Box
Reply to: #959153 by Green Tortuga
Apr 15, 2018 6:07pm
Thread (disabled) Board
But if you search for ^liberty, it'll return only boxes that start with that word.

You could always go with Perl regular expressions and use "^liberty$" to search for boxes that are only the word "liberty".
Re: top search results show exact box name match
Board: Suggestion Box
Reply to: #959155 by Oberon_Kenobi
Apr 15, 2018 8:44pm
Thread (disabled) Board
You could always go with Perl regular expressions and use "^liberty$" to search for boxes that are only the word "liberty".

You obviously know why I chose the ^ symbol for that purpose. =)

I thought about adding the $ symbol as well but didn't for two reasons.

  1. AQ already supported searches for "match the beginning of the box name"--even if it wasn't readily obvious or well known. I didn't actually have to add new functionality to make that work. Less work for me! But the main reason....
  2. Supporting the $ symbol would imply that you could run a search like "liberty$" to return a list of all boxes that ended with the word liberty. But that wouldn't work for two reasons: (1) there's no index in the database for the last word in a box name so the search would be super slow, and (2) it would search the last word of the box name rather than the series name so results would not necessarily be what people expected.

In theory, I could add support for "^liberty$" rather easily (as long as it didn't include support for "liberty$" too), but it seemed like a moot point since "^liberty" sorts boxes by name and a name with just that word will always end up first in the search results.

-- Ryan
Re: top search results show exact box name match
Board: Suggestion Box
Reply to: #959153 by Green Tortuga
Apr 16, 2018 1:14am
Thread (disabled) Board
Wow! That actually works for me! :-)

The URL hack is pretty easy - just changing "name" to "exactname."

Ironically before you posted the "^" option, my dh (a Unix dude) told me that would be easy to do in Unix grep with a "^" first and a "$" last (like Oberon_Kenobi mentioned). That's when I rolled my eyes. Unix is so NOT user friendly but admittedly useful.

But the "^" works! Great! That's the least click option. :-)

I am not quite seeing how the search list is alphabetical by default. This search (https://www.atlasquest.com/results.html?typeId=17;name=liberty) doesn't look alphabetical to me, but that's okay.

Nevertheless thanks for your response. I will use these suggestions. [Bookmarking your post.]
Re: top search results show exact box name match
Board: Suggestion Box
Reply to: #959158 by roo
Apr 16, 2018 8:04am
Thread (disabled) Board
I am not quite seeing how the search list is alphabetical by default. This search (https://www.atlasquest.com/results.html?typeId=17;name=liberty) doesn't look alphabetical to me, but that's okay.

It's only alphabetical when you use the ^ option. When you search for just liberty (without the ^), it sorts from most relevant to least relevant. It's kind of a magic formula that the database creates trying to guess which entries were the ones you were most likely trying to find and I can't even guess how that algorithm works.

So a search for the word "liberty" will match all boxes that use that word, but the database has trouble trying to decide if "Lady Liberty" or "Statue of Liberty" would be a better match for your search. Logically, as human beings, we would think that a box named just "Liberty" would be the best match and should rank better than those other two, but the database doesn't think like a human.

The results improve when you start using more than one word--there's more information for the database to work with. If you searched for the words "lady liberty", it would return all boxes with the word "lady" OR the word "liberty", but boxes that use both words would rank higher than boxes that use one or the other word--which is what we want.

In any case, the thing to keep in mind is that it's searching keywords in the name of the box and sorts them based on the algorithm the database uses to determine each box's "relevance".

When you search for boxes that start with a specific word, not of that happens. It just sorts alphabetically.*

-- Ryan

* = There are a couple of caveats to the sorting alphabetically. Stopwords (common words like "the", "a", etc.) are ignored. Punctuation (quotation marks, periods, etc.) for the most part is ignored. And there are still the hidden words of the individual box name if its part of a series, so a series+box named "Liberty+Zebra" would sort lower than a one-box series named "Liberty Lady"--even though in the search results it would look like "Liberty Lady" comes before "Liberty". But for all intents, it's more-or-less alphabetical, which does not happen when you do a usual "liberty" search where it's sorted based on "relevance."
Re: top search results show exact box name match
Board: Suggestion Box
Reply to: #959153 by Green Tortuga
Apr 16, 2018 3:56pm
Thread (disabled) Board
Ry Ry, you are da man!