use whoosh to search across issues in a github repository
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Charles Reid f7ee48357b Merge branch 'round2' of charlesreid1/issues-search into master 7 years ago
img add image to readme 7 years ago
static add static and template (init commit) 7 years ago
templates add boolean is_comment to schema, and modify output of template based on boolean 7 years ago
.gitignore add init frontend (app) and backend (search) 7 years ago
LICENSE add a license 7 years ago
Readme.md add image to readme 7 years ago
Todo.md add todo item 7 years ago
config.py.sample add init frontend (app) and backend (search) 7 years ago
issues_app.py get repos and repo org from config file, not hard-coded 7 years ago
issues_search.py add boolean is_comment to schema, and modify output of template based on boolean 7 years ago
make_markdown.py renaming issues programs to be pythonic 7 years ago
markdown_parser.py add markdown parser from markdown-search 7 years ago
requirements.txt add boolean is_comment to schema, and modify output of template based on boolean 7 years ago

Readme.md

issues-search

use whoosh to search github issues.

Implemented in Python using Flask, Whoosh and Mistune.

notes

had to update how the update process worked:

  • seems inefficient, but re-adding every document every index update
  • works fine if not updating all the time
  • gonna need to grab the content every time anyway
  • need to add a field that's the content's hash
  • compare indexed content's hash with fetched content's hash

when changing the schema:

  • the schema changes, so the document addition changes (args)
  • but also,
    • in issues_app.py we call the search() method on our Search object
    • in issues_search.py, search() method calls create_search_result()
    • create_search_result() extracts particular fields and bundles them up
    • the search results are ultimately returned to the app's /search endpoint, which passes them to a template as-is: search.html
    • keyword: entries = result
    • therefore, search.html and create_search_result() must also change to reflect changes in field names

summary of how to change the schema:

  • issues_app.py:
    • just combines the schema with the template, nothing to update
  • issues_search.py:
    • main place where schema is defined/used
    • Search class defines Schema object, main definition
    • add_issue() (equally important) which defines how to extract the fields defined in the schema from the document
    • create_search_result() (also important) which packages up the search results for the template to deal with
  • search.html: the search.html template uses a different variable namespace than the Python file issues_search.py or the flask app
    • The create_search-result() method of issues_search.py defines how search results are parsed and packaged for the search.html template
    • Jinja variables used in search.html should be defined in create_search_result() method of issues_search.py