administration mode
Pssst...Ferdy is the creator of JungleDragon, an awesome wildlife community. Visit JungleDragon


Supa Dupa Search »

FERDY CHRISTANT - OCT 9, 2004 (02:32:50 PM)

As of now, this site has a search, a new important feature of blog.s3maphor3.

Functionally, the search is as simple as can be. It returns a list of links, with a maximum of a 100, of the most relevant matches. You can also see whether the search result is a blog, article, page or comment. Simple, but it works.

Technically, it's quite a challenge to implement a XHTML-compliant search. You cannot use searchtemplates in HTML mode, Domino does not allow it, end of discussion. I was afraid to have to use an agent that would spit out the full XHTML markup. That would suck, since it would mean I would have to repeat my carefully crafted layout structure in more than one place. That would be against the DRY principle (Don't Repeat Yourself), and I wouldn't wanna piss of the Pragmatic Programmers would I?

In a nutshell, here's the solution:

  • Every page has a search subform embedded. The search subform is a small block of HTML that defines the in-line search form. This custom form has its action attribute pointed to the creation URL of a special form.
  • The special form has SaveOptions set to 0 to block saves. The $$Return field simply redirects the entered search query to the search result form, passing the query along with the URL.
  • The search result form receives the search query and uses it to call a Java agent. The Java agent does the actual searching and prints out a javascript array of return values.
  • The returned javascript array is used in a javascript function that loops through it and prints them out. Et voila!
The advantage: The agent only prints the search results, not all the other HTML that makes up the site layout. This way we have not repeated ourselves.

Existing s3 bloggers: The search is implemented as an optional navigation block, you can choose to enable or disable it in the setup screen.

We're close to 1.00....stay tuned. Oh, and do stress-test my search, I'm curious if you can break it. Happy weekend!

Comments: 5


OCT 12, 17:16:09

comment » Hi Ferdy,

Never challenge a critical public!

I prefer Google style search. If I type two search terms, I try to search for x AND y. Could that be added to your agent? Now it searches for "x y".

Also, it would be nice to display the search terms in the search bar of the search results page. Thus you recieve feedback on your search terms (why did I get zero hits? oh, I mistyped my search term) and you can easily adapt your search query.

Check, it should be possible in xhtml also. «


OCT 12, 17:25:15

comment » I like it that it searches through the comments as well. And that is opens the comment on the page it comments to. The list of search results can grow fast as this blog grows. Therefore it would be handy to make the search results sortable. You already made use of sortable views in the template. It would be nice to be able to sort the search results on title, author, date and document type. «


OCT 12, 20:14:53

comment » Laurens,

I prefer an internal database search for two reasons:

1) I'm not dependant on yet another vendor (Google)

2) I'm not dependant on an internet connection, thus this blog can be used on intranets as well.

The search should already display your search term in the results, perhaps you missed it?

The search results could indeed be richer. in markup. I'll see if I can fit in that change before version 1.

Thanks for your feedback! «


OCT 13, 08:25:25

comment » Dear Ferdy,

Thank you for your prompt feedback as always. Great you will be trying to enrich the search result page.

I was unclear about the other two points, my apologies. The search results already displays the search terms, but NOT in the search bar. It displays it as straight text above the search results. You have to re-enter the search terms in the search box to modify / refine your search. What you could do is add to the search field is VALUE="" where computed value are the search terms.

The second unclear point is about the Google style search. I didn't mean to use Google, but just their syntax. The Google syntax means it searches for all searchterms you enter with an AND operator in between them. Please read on this. Most users, not aware of the Notes syntax, will not realize they have to enter AND between two or more search terms to get the search they intend! «


OCT 13, 19:02:47

comment » Laurens,

A valid point about the AND, I'll look into this. Ty «

required field
required field HTML is not allowed. Hyperlinks will automatically be converted.