Searching algorithmics: Parsing and processing a request

Posted by James P. on Stack Overflow See other posts from Stack Overflow or by James P.
Published on 2010-12-23T18:01:22Z Indexed on 2010/12/23 23:54 UTC
Read the original article Hit count: 218

Say you were to create a search engine that can accept a query statement under the form of a String. The statement can be used to retrieve different types of objects with a given set of characteristics and possibly linked to other objects. In plain english or pseudo-code using an OOP approach, how would you go about parsing and processing statements as follows to get the series of desired objects ?

  • get fruit with colour green
  • get variety of apples, pears from Andy
  • get strawberry with colour "deep red" and origin not Spain
  • get total of sales of melons between 2010-10-10 and 2010-12-30
  • get last deliverydate of bananas from "Pete" and state not sold

Hope the question is clear. If not I'll be more than happy to reformulate.

P.S: This isn't homework ;)

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about language-agnostic