title: Keyword to SQL search
body: <p><em>Use Case</em></p>
  
  <p>When a user goes to my website, they will be confronted with a search box much like SO. They can search for results using plan text. ".net questions", "closed questions", ".net and java", etc.. The search will function a bit different that SO, in that it will try to as much as possible of the schema of the database rather than a straight fulltext search. So ".net questions" will only search for .net questions as opposed to .net answers (probably not applicable to SO case, just an example here), "closed questions" will return questions that are closed, ".net and java" questions will return questions that relate to .net and java and nothing else.</p>
  
  <p><em>Problem</em></p>
  
  <p>I'm not too familiar with the words but I basically want to do a keyword to SQL driven search. I know the schema of the database and I also can datamine the database. I want to know any current approaches there that existing out already before I try to implement this. I guess this question is for what is a good design for the stated problem.</p>
  
  <p><em>Proposed</em></p>
  
  <p>My proposed solution so far looks something like this</p>
  
  <ol>
  <li>Clean the input. Just remove any special characters</li>
  <li>Parse the input into chunks of data. Break an input of "c# java" into c# and java Also handle the special cases like "'c# java' questions" into 'c# java' and "questions".</li>
  <li>Build a tree out of the input</li>
  <li>Bind the data into metadata. So convert stuff like closed questions and relate it to the isclosed column of a table.</li>
  <li>Convert the tree into a sql query.</li>
  </ol>
  
  <p>Thoughts/suggestions/links?</p>