My favorites | Sign in
Project Home Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
Search  
Updated May 2, 2010 by andrewpb...@gmail.com

----------------------------------- Strategy Outline -----------------------------------

Overview

There are basically 2 functional parts to this project and 2 display parts. We decided each of the functional parts has, in essence, 2 levels of complexity we can develop. We figure in the interest of getting functionality down, then expanding to more features, we broke each into 2 potential phases of development. We'll start with functionality (1) for each then, time permitting, incorporate functionality (2):

  1. Google-style query
    1. Single-term search (ie: anything typed in the box is considered a "search term" that gets plugged into the relevant queries)
    2. Multi-term search (ie: multiple "search terms" can be strung together with AND/OR, parsed on back end and custom searched accordingly)
    1. this could also be broken up further, ie: do just ORs first, then ANDs
2. Form-based filtering
  1. One text box for a search term and a list of all searchable models (ie: faculty, students, classes, websites, etc). Each has a check-box to include in the search.
2. Each model with checkbox also has its own text box, and queries search each model for its individual search term (ie: classes where number = CS373 and faculty where last_name == "downing")

The display parts are basically:

  1. Forms and Search Results
2. Profile display

Implementation

Separation of front-end and back-end development

To best separate font- and back-end, we'll use a true model-view-controller separation of implementation:

  1. Model (see "Calls to model.search()" below)
2. View:
  1. Will receive the result in the defined format (see "Results Compilation" below) and display the results in formatted html. These results will be abbreviated versions of the "Faculty Profiles" based on the results provided and will link to full versions of the related profiles.
3. Controller:
  1. There will be a primary controller the catches the input from the search fields or filter form and makes the calls to the model.search() methods accordingly. This will be where the inputs from the user are parsed and broken into the individual searches, then the results from these searches are complied into the final result format (see "Results Formats" below) that is passed to the View for display

Calls to Model.search()

To accommodate this with minimal editing of code for feature enhancement, we decided on a format for search calls to be uniformly called. To implement, each model we will search by (we'll compile a complete list) will implement a "search" method. This method will take as its argument a dictionary in the format modeName.search({"field" : "search Term", "field2" : "search term 2", ...}).

For the first round of implementation, we will simply pass all arguments in a dictionary with a single entry: modelName.search({"all" : "search term"}). This way, we know we are searching all fields for a single search term, but if we have time to expand functionality, we do not have to modify the function signatures, only the handling of the argument to accommodate multiple fields.

Results Format

Results from each search method above will be in a consistent format to allow for easy handling. The results returned will be a dictionary formatted as follows:

return {

"facultyID1" : { "modelName" : "resultID1", "resultID2", ... } "facultyID2" : { "modelName" : "resultID1", "resultID2", ... }
}

While at first glance the "modelName" item seems redundant, since we made this call to a specific model, but this will allow for easier handling when we compile results from multiple models...

Results Compilation (handled by controller)

Each result will be received by the controller and combined in the format below: {

"facultyID1" : { "modelName1" : "resultID1", "resultID2", ... , "modelName2" : "resultID1", "resultID2", ... , ... } "facultyID2" : { "modelName1" : "resultID1", "resultID2", ... , "modelName2" : "resultID1", "resultID2", ... , ...} "facultyID3" ...
}

This will allow us to display results grouped by faculty members with search results identified by what exactly matched the search term, which will look something like:

SEARCH RESULTS FOR "SWE":

  • Glenn Downing
  • o Class: CS373 - SWE o Conference: SWE in the real world
  • John Smith
  • o Website: www.swe.com o Writing: Why the world needs SWE
Powered by Google Project Hosting