Want to buy or sell something? Check the classifieds
  • The Fedora Lounge is supported in part by commission earning affiliate links sitewide. Please support us by using them. You may learn more here.

Search Tool for TFL

TheDane

Call Me a Cab
Messages
2,670
Location
Copenhagen, Denmark
Abstract:
TFL's search engine could, as most of us know, be a lot more useful. The TFL team and the developers behind the board software are not to blame. It's a very complex task to write such a feature, and an advanced search on Google will usually give a better result than any board software.

In the following I will first show how you can do such a fine tuned Google search "by hand". I will then show how to implement a small feature in your browser to make the task a lot easier.

Site Specific Search:
Google offers quite a number of ways to fine tune your search. One is the "site specific" search, that only returns results from a explicitly named site. It is done by adding the string: " site:the_specific_site.com" (without the quotes) to your actual search string.

In our case, we add the string: " site:thefedoralounge.com" (still without the quotes) to the content in the search field on the Google page. Instead of "Stetson 100", you write: "Stetson 100 site:thefedoralounge.com" - and hit the button. Then only pages from TFL will be present in the result.

To get results from the threads only you can even add "/threads" to the search string: "Stetson 100 site:thefedoralounge.com/threads"

It's a great feature, but it soon gets very tedious to write TFL's loooooong site name over and over again.

Bookmarklet:
My personal solution is to use a so called "bookmarklet". It consists of a "favorite" or "bookmark" - but instead of navigating the browser to a specific web-address (URL), the bookmark executes a small program code against the page, currently loaded in the browser.

In short: The bookmarklet will do all the writing (" site:thefedoralounge.com/threads") for you, if you run it with Google loaded in the browser. If you are interested in the technique and/or the theory behind, you can google "Bookmarklet". In the following I will only show you how to create the special kind of bookmark and how to get it to work.

How To:
In your standard/preferred browser make a bookmark of a random page (could be this page). Open the bookmark for editing. This is done in different ways, depending on the specific browser and device. On a PC you would usually right-click the bookmark and look for "Properties".

In the "Name" field of the pop-up dialog you write "_TFL Search". The underscore ("_") will bring the bookmark to the top of your list

In the "Address" or "URL" field you delete the content and copy/paste the following line of JavaScript code instead:

javascript:var%20i=document.getElementsByName("q")[0];if(i&&i.name=="q"&&i.value!=""){i.value+="%20site:thefedoralounge.com/threads";i.form.btnG.click()};void(0)

- and save the edited bookmark. The bookmark will now be found as "_TFL Search", and it's functionality has changed into being a small program - a bookmarlet.

Internet Explorer Note:
Explorer's Properties dialog is a little different. The code line should be copy/pasted into the "URL" field under the "Web Document" tab - and the name "_TFL Search" should be written in the nameless top field under the "General" tab

Very important:
As a security precaution some browsers will not let you paste "javascript:" into the Address/URL field. Therefore you should check that the content of that field starts with "javascript:" after pasting the code. If not, you must write it by hand. Don't forget the colon!

Try it out:
With Google loaded in your browser write "Stetson 100" in the search field. Then click your new "_TFL Search" bookmarklet.

The bookmarklet will automatically add " site:thefedoralounge.com/threads" to the field content and "click" Google's "Search" button for you. The search result should now be visible in the browser.

Why doesn't it work?
I haven't got a clue, but I will try to keep an eye on this thread. Write a description of the problem, and I will try to guide you through. Other loungers are of course more than welcome to chime in with their help too ;)

The code will "break" the day Google choses to change their frontend code. I frequently use the bookmarklet myself, so I'll probably notice such a change. If not, please let me know, and I will upload a refactored code.

Hope this will be helpful :)
 

Bob Roberts

I'll Lock Up
Messages
11,201
Location
milford ct
Abstract:
TFL's search engine could, as most of us know, be a lot more useful. The TFL team and the developers behind the board software are not to blame. It's a very complex task to write such a feature, and an advanced search on Google will usually give a better result than any board software.

In the following I will first show how you can do such a fine tuned Google search "by hand". I will then show how to implement a small feature in your browser to make the task a lot easier.

Site Specific Search:
Google offers quite a number of ways to fine tune your search. One is the "site specific" search, that only returns results from a explicitly named site. It is done by adding the string: " site:the_specific_site.com" (without the quotes) to your actual search string.

In our case, we add the string: " site:thefedoralounge.com" (still without the quotes) to the content in the search field on the Google page. Instead of "Stetson 100", you write: "Stetson 100 site:thefedoralounge.com" - and hit the button. Then only pages from TFL will be present in the result.

To get results from the threads only you can even add "/threads" to the search string: "Stetson 100 site:thefedoralounge.com/threads"

It's a great feature, but it soon gets very tedious to write TFL's loooooong site name over and over again.

Bookmarklet:
My personal solution is to use a so called "bookmarklet". It consists of a "favorite" or "bookmark" - but instead of navigating the browser to a specific web-address (URL), the bookmark executes a small program code against the page, currently loaded in the browser.

In short: The bookmarklet will do all the writing (" site:thefedoralounge.com/threads") for you, if you run it with Google loaded in the browser. If you are interested in the technique and/or the theory behind, you can google "Bookmarklet". In the following I will only show you how to create the special kind of bookmark and how to get it to work.

How To:
In your standard/preferred browser make a bookmark of a random page (could be this page). Open the bookmark for editing. This is done in different ways, depending on the specific browser and device. On a PC you would usually right-click the bookmark and look for "Properties".

In the "Name" field of the pop-up dialog you write "_TFL Search". The underscore ("_") will bring the bookmark to the top of your list

In the "Address" or "URL" field you delete the content and copy/paste the following line of JavaScript code instead:

javascript:var%20i=document.getElementsByName("q")[0];if(i&&i.name=="q"&&i.value!=""){i.value+="%20site:thefedoralounge.com/threads";i.form.btnG.click()};void(0)

- and save the edited bookmark. The bookmark will now be found as "_TFL Search", and it's functionality has changed into being a small program - a bookmarlet.

Internet Explorer Note:
Explorer's Properties dialog is a little different. The code line should be copy/pasted into the "URL" field under the "Web Document" tab - and the name "_TFL Search" should be written in the nameless top field under the "General" tab

Very important:
As a security precaution some browsers will not let you paste "javascript:" into the Address/URL field. Therefore you should check that the content of that field starts with "javascript:" after pasting the code. If not, you must write it by hand. Don't forget the colon!

Try it out:
With Google loaded in your browser write "Stetson 100" in the search field. Then click your new "_TFL Search" bookmarklet.

The bookmarklet will automatically add " site:thefedoralounge.com/threads" to the field content and "click" Google's "Search" button for you. The search result should now be visible in the browser.

Why doesn't it work?
I haven't got a clue, but I will try to keep an eye on this thread. Write a description of the problem, and I will try to guide you through. Other loungers are of course more than welcome to chime in with their help too ;)

The code will "break" the day Google choses to change their frontend code. I frequently use the bookmarklet myself, so I'll probably notice such a change. If not, please let me know, and I will upload a refactored code.

Hope this will be helpful :)
Shoot! I knew all that... But what the heck did I just read?
 

Forum statistics

Threads
109,327
Messages
3,078,968
Members
54,243
Latest member
seeldoger47
Top