Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Orion/Documentation/User Guide/Reference/Search Results page"

(Report page)
(Sample work flow: refactor a function name)
Line 110: Line 110:
 
As the search itself is based on pages, the replace is based on page as well. Click on <b>Next pages</b> or <b>Previous pages</b> to replace the same key word by the same replacing word.
 
As the search itself is based on pages, the replace is based on page as well. Click on <b>Next pages</b> or <b>Previous pages</b> to replace the same key word by the same replacing word.
  
= Sample work flow: refactor a function name =
+
= Sample user story: refactor a function name =
Lets say there is a function called calculateRange that is used in 60 files. User <b>A</b> creates a new function called advancedCalculateRange and wants to replace with it in 5 files. In the mean while user <b>B</b> modified and saved one of the files.
+
Lets say there is a function called calculateRange that is used in 60 files. User <b>A</b> creates a new function called advancedCalculateRange and wants to replace with it in 5 files. In the mean while user <b>B</b> modified and saved one of the files. The steps below describes the complete <b>work flow</b>:
 
# User A [[#Starting_search|searches on]] key word <b>calculateRange</b>. In the first result page, there are 3 files that user A wants to replace.
 
# User A [[#Starting_search|searches on]] key word <b>calculateRange</b>. In the first result page, there are 3 files that user A wants to replace.
 
# User A starts [[##Invoking_replace|replace]] and types <b>advancedCalculateRange</b>.
 
# User A starts [[##Invoking_replace|replace]] and types <b>advancedCalculateRange</b>.

Revision as of 18:50, 27 February 2012

Search Results page

The Search Results page displays files for any search performed in the search entry field in the title area of any page. Each file is expandable to display all the matches with the lines containing the search keyword and the line number. You can use right arrow key to pop up a 5-line context around the line or you can click on any file or match to open the Orion editor to see the whole file at that line. The page is designed to display multiple pages if the result files exceeds 40. There are previous and next page actions in the tool bar for you to go through all the results.

Orion-search-ResultOverview.png

Starting search

Starting search is very simple: just type or paste a keyword in the search entry field and hit enter. The result will be displayed in the same tab of your browser where you entered the keyword. The header of the result displays the total file number and the number range of the first page. Both literal and wild card search are supported. For example, "fo*ar" will hit all the files containing "foobar" while "fo??ar" will hit the same files. Please also note that the search ignores case.

Search starting search.png

Search scopes

If you start a search from a page where a folder is presented, or in another word, if bread crumb is presented, the place holder of the search entry field indicates the folder name on which your search will start. Currently the pages supporting this are navigator, git log, editor and search pages. For all other pages, the search will start from the project root. But once you are in the search result page, you can scope up and down the result on the same keyword.

Search scope overall.png

Scoping down

Lets assume that you just searched for "function" on a folder and you got 265 files but you want to see the results on a folder you are interested. You can now click on the location column where the interesting folder is presented. The result will be scoped down to that folder by the same keyword.

Search scope down.png

Scoping up

If your search result presents a sub folder but you want a broader scope, you can click on any segment in the bread crumb. The result will be scoped up to that folder by the same keyword.

Search scope up.png

Saving search

Click Save Search in the tool bar to bookmark a link to this search for future use. Lets say you are searching "foo" on folder "bar". The default name of the saved search is "foo in bar" but you can rename it later to a more meaningful one. Note that this is a bookmark to the search, rather than a specific search result. Clicking on a link in the Searches list of the Favorites panel will perform a new search with the same search terms.

Search save search.png

Navigating matches

There are 4 actions in the tool bar for navigating matches. Expand all and Collapse all are convenient actions to view all matches or just view the file list. Up and Down allow you to just iterate all the files and matches top-down or bottom-up. While you are iterating, the current row is moving to indicate where you are. You can also jump over to a specific file or match by clicking on that row, which gives a quick switch-over to where you want to start the iteration. The current row is always cached as the browser's cookie based on the search URL. If you leave the page and come back or refresh the page, the current row is restored.

Key board navigation

When search result page is loaded, the result pane is focused and the current row is highlighted where you can use the key board navigation. Note that key board navigation is available only when the result pane gets focus. If focus is not on the result pane, just click on any place in the result pane to get it back.

Search kb navigation.png

  • To move the current row, use up and down arrow keys. You can also change the current row by clicking on the anywhere of any row.
  • To expand or collapse the current row, use right and left arrow keys.
  • To open a file or go to the matching line with that file, use Enter key.
  • To open a file or go to the matching line with that file in a new tab, use Ctrl+Enter key.

Viewing details

There are two ways to view details on a match. When the current row is on a match, pressing right arrow</> key will pop up a context tip with 5 lines of code around the hit line. Note that if you use <b>up</> and <b>down arrow keys from now, the context tip changes contents when a match is iterated. Use left arrow key to cancel the context tip. If you want to view more details, press enter key or click on the link of the match. This will open the Orion editor with the line located at the matching place.

Search view details.png

Navigating pages

If the number of matching files exceeds the page size, which is 40 by default, the Next page and Previous page actions will appear in the tool bar. Although it is not recommended to change the search URL, but if you really want to view all the results in one page you can change the rows parameter to the total file number. In the example above you can change rows=265 so that the new search url will look like http://orion.eclipse.org/search/search.html#?sort=Path asc&rows=265&start=0&q=function+Location:/file/B2/bundles/*. Note that changing this to a large number should only be used in some rare cases, such as replacing more than 40 files at once. Please also note that this could slow down the search and introduce server timeout.

Sort by name or location

The matching files are sorted by the folder names by default. Click on the options on the tool bar and check Sort by Name to invoke the search again sorted by the file names.

Search options name loc.png

Stale files

Orion search is based on the file indexer on the server side. There may be some rare cases that your updated files are not synced up into indexer yet when you invoke the search. For example, if you search on foo and replace all the matches with bar in a file and then search on foo again right away. Depending on how many files on the server, the indexer may still hit the file but the file does not contain foo any more. In this case the file is greyed out in the result list but if you search gain later it will disappear from the list completely.

Search stale files.png

Current limitations

There are several limitations that will be addressed in the future releases.

  • Case sensitive search is not supported.
  • Phrase search separated by white space. Note that white space is escaped when passing the key word to the sever. For example, foo bar will be treated as foobar.
  • When sorting by name, all the upper case file names are sorted in front of all lower cases.


Replace page

Replace page allows you to replace all or part of the matches by a new string. You can select what files and which matches you want to replace with the replacing string. After all the selected files are replaced, a report page indicates the success or failure.

Invoking replace

In the search result page, click on Replace on the tool bar to bring up the slide out. Type the replacing string and hit enter or click on Preview Changes to go to the replace page. Note you can also use ESC key or click on x to go back to the search page.

Search invoke replace.png

Filtering matches

In the replace page, all the files and matches are displayed in a similar way as the result page does. In addition to that you can use check box to select the files and matches you want to replace. Note that if there are multiple matches in a single line, it will be split to multiple lines where each line represents one match. There are 3 levels of the check box.

  • Overall: this allows you to toggle all the files and matches.
  • File level: this allows you to toggle all the matches in a file.
  • Match level: this allows you to toggle each match.

Search replace filtering.png

Key board navigation

The key board navigation in replace page is similar to result page. But as the file and match names are not links to open the editor, enter key is not available. Also note that there is no context tip because you can view them in the compare view.

  • To move the current row, use up and down arrow keys. You can also change the current row by clicking on the name column of any row.
  • To expand or collapse the current row, use right and left arrow keys.
  • To toggle the check box of the current row, use the space key.
  • To select multiple rows, use shift+up/down keys.

Viewing differences

When the replace page is loaded, the compare view is displayed by default at the bottom of the main pain. While you are iterating matches, the compare view highlights the difference for the current row. Note that you can click on Hide Compare on the tool bar to hide it for a smoother iteration and bring it back later by Show Compare.

Search replace view diff.png

Committing changes

Once you have selected all the matches that you want to replace, click on Commit on the tool bar. This will write all the replacement on the server.

Report page

After the changes are committed, the replace page displays a list of files indicating the success or failure of the replacement. It also reports on how many matches were replaced on each file. You can click on any file to see the new content in a new tab. If some body else has changed the same file while you are replacing, a failure is generated and you have to refresh the page to redo it. The report is not really a page by different URL. Refreshing the page will just restart the replacement.

Search replace report.png

Also note that if the changes happen on the working directory of a git repository, you can undo them in git status page.

Replacing page by page

As the search itself is based on pages, the replace is based on page as well. Click on Next pages or Previous pages to replace the same key word by the same replacing word.

Sample user story: refactor a function name

Lets say there is a function called calculateRange that is used in 60 files. User A creates a new function called advancedCalculateRange and wants to replace with it in 5 files. In the mean while user B modified and saved one of the files. The steps below describes the complete work flow:

  1. User A searches on key word calculateRange. In the first result page, there are 3 files that user A wants to replace.
  2. User A starts replace and types advancedCalculateRange.
  3. User A selects the 3 files and relative matches that will be replaced.
  4. User A compares and confirms the differences between the original and replaced lines.
  5. User A commits the new contents of the 3 files to the server.
  6. All the 3 files are written successfully indicated by the report.
  7. User A replaces the next page by selecting the remaining 2 files and relative matches.
  8. User B modifies one of the two files and saves it.
  9. User A commits the replacement.
  10. One of the files is reported written failure because it was modified during the replacing.
  11. User A refreshes the page to do the replace again by selecting only the failed file.
  12. User A commits the replacement. Reports indicates the successful replacement.
  13. Optional: User A wants to undo the changes and goes to git status page by checking out the changes.

Back to the top