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

From Eclipsepedia

Jump to: navigation, search
(Search scopes)
(32 intermediate revisions by 3 users not shown)
Line 1: Line 1:
= Search Results page =
+
= Search page =
The <b>Search Results</b> 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 lines that match the keyword. You can use right arrow key to pop up a 5-line context around the line. To view the file with the line located you can click on any match to open the editor. The page is designed to display multiple pages if the number of result files exceeds 40. To view more results you can use the previous and next page actions in the tool bar.
+
The <b>Search</b> page can be launched from any other Orion pages with a search scope. Refer to [[Orion/Documentation/User_Guide/Getting_started#Searching_for_file_content|Searching for file content section]] on how to launch the search page from different places.
 +
The left hand side of the page displays the search and replace field and all other options. The right hand side displays the result when you invoke the search. The header of the result pane displays the total number of matches and the number range of the first page. Each file is expandable to display all the lines that match the keyword. You can use right arrow key to pop up a 5-line context around the line. To view the file with the line located you can click on any match to open the editor. The page is designed to display multiple pages if the number of result files exceeds 40. To view more results you can use the previous and next page actions in the tool bar.
  
[[Image:Orion-search-ResultOverview.png]]
+
[[Image:search-page-overall.png|Search page]]
  
== Starting search ==
+
== Search completion ==
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.
+
When you type on the search field, there is a suggested list popping up under the field. The suggested list contains the most recent searched keywords, filtered by the current typed. The max number of the recent keyword is 20.
  
[[Image:search_starting_search.png]]
+
You can also delete the recent keyword when it is highlighted. Note that if you use backspace key till the search field is empty, it will show you <b>all</b> the recent search terms.
  
== Search scopes ==
+
[[Image:search-page-completion.png|Search completion]]
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 for the same keyword.
+
  
[[Image:search_scope_overall.png]]
+
== Filter the search result ==
 +
In the result pane, there is a way to narrow down the number of the files and the lines of matches. Type a keyword in the filter box and it will display only the files and matching lines that contain that filter keyword. Note that the search term is highlighted by bold and the filter term is highlighted by the yellow background. If you backspace the filter to empty, it will show you all the results as normal.
 +
 
 +
[[Image:search-page-filter.png|Search completion]]
 +
 
 +
== Search scopes ==
 +
When you launch the search page, the bread crumb shows the current scope. But once the result pane shows some results, you can scope up and down for the same keyword from there.
  
 
=== Scoping down ===
 
=== Scoping down ===
Lets assume that you've 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.
+
Let's assume that you've 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 in. 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.
  
[[Image:search_scope_down.png]]
+
[[Image:searchPage-scopedown.png|Search location column]]
  
 
=== Scoping up ===
 
=== 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.
+
If your search result presents a sub folder but you want a broader scope, you can click on any segment in the breadcrumb. The result will be scoped up to that folder by the same keyword.
  
[[Image:search_scope_up.png]]
+
[[Image:searchPage-scopeUp.png|Search breadcrumb]]
  
== Saving search ==
+
== My Saved Searches ==
  
Click <b>Save Search</b> 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 <b>Searches</b> list of the Favorites panel will perform a new search with the same search terms.
+
On the left hand side of the page you can name a search and save it.  
 +
=== Saving a search ===
 +
Let's say you are searching "foo" on folder "bar". The default name of the saved search is "foo in bar" when you invoke the search. You can click on the save button to decide if you want to save it.  
 +
The saved searches are displayed in the bottom part of the left hand side pane, called <b>My Saved Searches</b>.
  
[[Image:search_save_search.png]]
+
Note that this is a bookmark to the search, rather than a specific search result. Clicking on a link in the <b>My Saved Searches</b> will perform a new search with the same search terms.
 +
 
 +
[[Image:searchPage-saveSearches1.png|Save search button]]
 +
 
 +
You can also filter and perform the saved searches from the search completion under the search field when you type.
 +
 
 +
[[Image:searchPage-saveSearches2.png|Save search button2]]
 +
 
 +
=== Edit a saved search ===
 +
You can select a search to delete or rename it. Note that multiple selection is allowed but only delete action is available for multiple selection.
 +
 
 +
[[Image:searchPage-saveSearchesEdit.png|Save search edit]]
  
 
== Navigating matches ==
 
== Navigating matches ==
There are 4 actions in the tool bar for navigating matches. <b>Expand all</b> and <b>Collapse all</b> are convenient actions to view all matches or just view the file list. <b>Up</b> and <b>Down</b> allow you to just iterate all the files and matches top-down or bottom-up. While you are iterating, the current <b>row</b> 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 <b>row</b> 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.
+
There are four actions in the tool bar for navigating matches. <b>Expand all</b> and <b>Collapse all</b> are convenient actions to view all matches or just view the file list. <b>Up</b> and <b>Down</b> allow you to just iterate all the files and matches top-down or bottom-up. While you are iterating, the current <b>row</b> 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 <b>row</b> 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 ==
+
== Keyboard 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.
+
When the pane is loaded, it is focused and the current row is highlighted where you can use the keyboard navigation.
Note that key board navigation is available only when the <b>result pane</b> gets focus. If focus is not on the result pane, just click on any place in the result pane to get it back.
+
Note that keyboard navigation is available only when the <b>result pane</b> gets focus. If focus is not on the result pane, just click on any place in the result pane to get it back.
 
+
[[Image: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 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.
Line 43: Line 61:
 
* 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, use Enter key.
 
* To open a file or go to the matching line with that file in a new tab, use Ctrl+Enter key.
 
* To open a file or go to the matching line with that file in a new tab, use Ctrl+Enter key.
 +
 +
Keyboard navigation when doing replace is similar. 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.
  
 
== Viewing details ==
 
== Viewing details ==
There are two ways to view details on a match. When the current row is on a match, pressing <b>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</b> arrow keys from now, the context tip changes contents when a match is iterated. Use <b>left arrow</b> 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.
+
There are two ways to view details on a match. When the current row is on a match, pressing <b>right arrow</b> key will pop up a context tip with five lines of code around the hit line. Note that if you use <b>up</b> and <b>down</b> arrow keys from now, the context tip changes contents when a match is iterated. Use <b>left arrow</b> 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.
  
[[Image:search_view_details.png]]
+
[[Image:searchPage_view_details.png|View search result details]]
  
== Navigating pages ==
+
== Linking to the editor ==
If the number of matching files exceeds the page size, which is 40 by default, the <b>Next page</b> and <b>Previous page</b> 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 <b>rows</b> 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&<b>rows=265</b>&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.
+
When you choose to open the editor for more details, the editor will be opened with the find&replace feature for you.
 +
If you click on a file, the editor will open with the first match highlighted. If you click on a match, that match will be highlighted in the editor. You can then continue to work on this single file without bothering to bring the find&replace up again.
  
== Sort by name or location ==
+
[[Image:search_view_details_in_editor_new1.png|View search result in editor]]
The matching files are sorted by the folder names by default. Click on the options on the tool bar and check <b>Sort by Name</b> to invoke the search again sorted by the file names.
+
  
[[Image:search_options_name_loc.png]]
+
== Navigating pages ==
 +
If the number of matching files exceeds the page size, which is 40 by default, the <b>Next page</b> and <b>Previous page</b> actions will appear in the tool bar.
  
 
== Stale files ==
 
== 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 <b>foo</b> and replace all the matches with <b>bar</b> in a file and then search on <b>foo</b> again right away. Depending on how many files on the server, the indexer may still hit the file but the file does not contain <b>foo</b> 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.
+
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 <b>foo</b> and replace all the matches with <b>bar</b> in a file and then search on <b>foo</b> again right away. Depending on how many files on the server, the indexer may still hit the file but the file does not contain <b>foo</b> any more. In this case the file is greyed out in the result list but if you search again later it will disappear from the list completely.
  
[[Image:search_stale_files.png]]  
+
[[Image:search_stale_files_new.png|Stale files in the results]]  
 
   
 
   
== Current limitations ==
+
== Search and replace ==
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, <b>foo bar</b> will be treated as <b>foobar</b>.
+
* When sorting by name, all the upper case file names are sorted in front of all lower cases.
+
  
= Replace page =
+
=== Preview changes ===
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.
+
Type both a search term and replace term, click replace button. Now you will see a replace preview on the result pane.
 +
When the replace preview is loaded on the result pane, the compare view is displayed by default at the bottom of the result pane. While you are iterating matches, the compare view highlights the difference for the current row. Note that you can click on <b>Hide Compare</b> on the toolbar to hide it for a smoother iteration and bring it back later by <b>Show Compare</b>.
  
== Invoking replace ==
+
[[Image:searchPage_replace.png|View compare]]
In the search result page, click on <b>Replace</b> on the tool bar to bring up the slide out. Type the replacing string and hit <b>enter</b> or click on <b>Preview Changes</b> to go to the replace page. Note you can also use <b>ESC</b> key or click on <b>x</b> to go back to the search page. 
+
  
[[Image:search_invoke_replace.png]]  
+
=== Apply selected changes ===
 +
Refer to [[Orion/Documentation/User_Guide/Tasks/Navigating_and_searching#Search_and_replace_across_files|Search and replace across files]] for details.
  
== Filtering matches ==
+
== Current limitations ==
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 <b>split</b> to multiple lines where each line represents one match. There are 3 levels of the check box.
+
There are several limitations that will be addressed in the future releases.
* Overall: this allows you to toggle all the files and matches.
+
* If you enter multiple words in the search box, it will search for that exact phrase. Phrase search does not support wildcards, and will ignore punctuation between words. For example, if you search for <b>foo bar</b>, it will find matches such as <b>foo. (bar)</b>
* File level: this allows you to toggle all the matches in a file.
+
* Filter box in the replace preview is not available.
* Match level: this allows you to toggle each match.
+
* Case sensitive and regular expression search is not indexed.
 
+
[[Image: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 <b>Hide Compare</b> on the tool bar to hide it for a smoother iteration and bring it back later by <b>Show Compare</b>.
+
 
+
[[Image:search_replace_view_diff.png]]
+
 
+
== Committing changes ==
+
Once you have selected all the matches that you want to replace, click on <b>Commit</b> 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.
+
 
+
[[Image:search_replace_report.png]]
+
 
+
Also note that if the changes happen on the working directory of a git repository, you can [[Orion/Documentation/User_Guide/Reference/Git_Status_page#Reverting_a_group_of_unstaged_changes|undo]] them in git status page.
+
  
== Replacing page by page ==
+
== Related Tasks ==
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 user story: refactor a function name =
+
* [[Orion/Documentation/User_Guide/Tasks/Navigating_and_searching|Navigating and searching]]
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 starts [[##Invoking_replace|replace]] and types <b>advancedCalculateRange</b>.
+
# User A [[#Filtering_matches|selects]] the 3 files and relative matches that will be replaced.
+
# User A [[#Viewing_differences|compares and confirms]] the differences between the original and replaced lines.
+
# User A [[#Committing_changes|commits]] the new contents of the 3 files to the server.
+
# All the 3 files are written successfully indicated by the [[#Report_page|report]].
+
# User A [[#Replacing_page_by_page|replaces the next page]] by selecting the remaining 2 files and relative matches.
+
# User B modifies one of the two files and saves it.
+
# User A commits the replacement.
+
# One of the files is reported written failure because it was modified during the replacing.
+
# User A refreshes the page to do the replace again by selecting only the <b>failed</b> file.
+
# User A commits the replacement. Reports indicates the successful replacement.
+
# <b>Optional:</b> User A wants to undo the changes and goes to git status page by [[Orion/Documentation/User_Guide/Reference/Git_Status_page#Reverting_a_group_of_unstaged_changes|checking out]] the changes.
+

Revision as of 15:39, 21 June 2013

Contents

Search page

The Search page can be launched from any other Orion pages with a search scope. Refer to Searching for file content section on how to launch the search page from different places. The left hand side of the page displays the search and replace field and all other options. The right hand side displays the result when you invoke the search. The header of the result pane displays the total number of matches and the number range of the first page. Each file is expandable to display all the lines that match the keyword. You can use right arrow key to pop up a 5-line context around the line. To view the file with the line located you can click on any match to open the editor. The page is designed to display multiple pages if the number of result files exceeds 40. To view more results you can use the previous and next page actions in the tool bar.

Search page

Search completion

When you type on the search field, there is a suggested list popping up under the field. The suggested list contains the most recent searched keywords, filtered by the current typed. The max number of the recent keyword is 20.

You can also delete the recent keyword when it is highlighted. Note that if you use backspace key till the search field is empty, it will show you all the recent search terms.

Search completion

Filter the search result

In the result pane, there is a way to narrow down the number of the files and the lines of matches. Type a keyword in the filter box and it will display only the files and matching lines that contain that filter keyword. Note that the search term is highlighted by bold and the filter term is highlighted by the yellow background. If you backspace the filter to empty, it will show you all the results as normal.

Search completion

Search scopes

When you launch the search page, the bread crumb shows the current scope. But once the result pane shows some results, you can scope up and down for the same keyword from there.

Scoping down

Let's assume that you've 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 in. 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 location column

Scoping up

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

Search breadcrumb

My Saved Searches

On the left hand side of the page you can name a search and save it.

Saving a search

Let's say you are searching "foo" on folder "bar". The default name of the saved search is "foo in bar" when you invoke the search. You can click on the save button to decide if you want to save it. The saved searches are displayed in the bottom part of the left hand side pane, called My Saved Searches.

Note that this is a bookmark to the search, rather than a specific search result. Clicking on a link in the My Saved Searches will perform a new search with the same search terms.

Save search button

You can also filter and perform the saved searches from the search completion under the search field when you type.

Save search button2

Edit a saved search

You can select a search to delete or rename it. Note that multiple selection is allowed but only delete action is available for multiple selection.

Save search edit

Navigating matches

There are four 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.

Keyboard navigation

When the pane is loaded, it is focused and the current row is highlighted where you can use the keyboard navigation. Note that keyboard 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.

  • 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.

Keyboard navigation when doing replace is similar. 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.

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 five lines of code around the hit line. Note that if you use up and 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.

View search result details

Linking to the editor

When you choose to open the editor for more details, the editor will be opened with the find&replace feature for you. If you click on a file, the editor will open with the first match highlighted. If you click on a match, that match will be highlighted in the editor. You can then continue to work on this single file without bothering to bring the find&replace up again.

View search result in editor

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.

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 again later it will disappear from the list completely.

Stale files in the results

Search and replace

Preview changes

Type both a search term and replace term, click replace button. Now you will see a replace preview on the result pane. When the replace preview is loaded on the result pane, the compare view is displayed by default at the bottom of the result pane. 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 toolbar to hide it for a smoother iteration and bring it back later by Show Compare.

View compare

Apply selected changes

Refer to Search and replace across files for details.

Current limitations

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

  • If you enter multiple words in the search box, it will search for that exact phrase. Phrase search does not support wildcards, and will ignore punctuation between words. For example, if you search for foo bar, it will find matches such as foo. (bar)
  • Filter box in the replace preview is not available.
  • Case sensitive and regular expression search is not indexed.

Related Tasks