• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Design Patterns for search engine

Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I'm sure you guys have seen the search engine of google or yahoo. Everytime you hit search, they would retrieve 1 web page of your results and the list of numbers of pages of your results. Like "page 1 of 8".
Does anyone know what kinda Design Pattern is used to develop this concept?
Do think this "trick" done via DB's stored procedure or via application layer?
Thank you.
- Simon See
-after office hours-
Posts: 6049
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The idea is known as "windowing." Maybe there's a pattern with a different name. Basically, you only see a small portion of the data at any given time, i.e. looking through a window at the data.
There are different implementations. You could retrieve all the info at once, but only display some of it at any given time. You could find the total hits, but for performance reasons, only cache some of it (say the first 1,000 out of 85,000 hits), and requery as necessary. You could also have an "unbounded window" in which you don't know the total, but just keeping getting X more hits at a time, until your run out.
Depending on how you are doing it, the "trick" may reside at different layers.

Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try looking at strategy type design patterns like Strategy and Template as explained in Design Patterns by Gamma et al.(GoF)
These will help with delegation of responsibilities or can extend existing algorithms for searching.
When it is used for evil, then watch out! When it is used for good, then things are much nicer. Like this tiny ad:
the value of filler advertising in 2020
    Bookmark Topic Watch Topic
  • New Topic