Personal tools

Labs/Bespin/DesignDocs/Editor/Search

From MozillaWiki

Jump to: navigation, search

Contents

Design Document: Search

Status: Malte working on searching across project

This is a 60 points implementation! :)

Overview

One of the core features in the usable theme is the notion of searching across your currently opened file and the entire project (or other subset of files).

Lets split up the two types of searching:

Search In File

We have a mockup for how this looks. Ignore the popup and just focus on the top right search area, the results overlay, and the highlighting of results:

bespineditor_find-and_search.png

We would like more of a contrast on the search results and where you currently are, but it is a good starting point.

The workflow for this feature is:

  • User shoots off a search action (Ctrl-/, type in the search box, or types "search foo" in the command line)
  • A search is done inside of the document and results are gathered and displayed
  • NOTES:
    • What is the search syntax? Purely subset? Regex allowed?
    • How do you give settings such as "Ignore case"?
      • When you start to type something into the search box itself add the options as an overlay below it (where the number of matches is shown when results are there) with check boxes. As soon as you run the search, the overlay changes to show the results as the image above
      • Do we also have "Replace?" which if you click on let's you type the item to replace
      • One off in the command line: search foo /i
      • Saved settings: set searchoptions +i
  • The user can navigate through the results with Cmd-G/Ctrl-G or the arrows
  • When the user clicks on "Done" or the [x] in the search, it all goes away

Search Across Files

Share as much of the UI as possible from the in-file searching feature above, but you also need the ability to:

  • Show the results in a webpieces overlay
    • The results should show the name of the file, directory it is in, and snippets of the matches
    • You can click on a result and jump to that file but still keep results up

Questions

  • Do we save the state of the last search?
  • When we pull up a search across files, the last set of results is there?
  • For now, search happens across the entire notion of the project, but in the future:
    • Allow for subset searching
    • Allow for project exclusions from search
    • Allow for searching across multiple projects
    • Allow for even tying to code search
  • Where is the search done:
    • On the server, or on the client using a Web Worker?
    • Do we use a client side DB where available?
    • This will tie into the "Offline" features.

Implementation

NOTE: Malte has already gotten the following:

  • Index all files in the project in a hash that maps words (and

substrings) to files and line numbers

  • persistent indexes across page load is not implemented (Client Side DB)
  • you cannot search substrings from the right side of a word
  • you cannot search for characters that do not match \w
  • you cannot search across lines (although this could be easily added)