[[BackLinksMenu]] [[TicketQuery(summary=BOOK_SEARCH_R0, format=table, col=summary|owner|status|type|component|priority|effort|importance, rows=description|analysis_owners|analysis_reviewers|analysis_score|design_owners|design_reviewers|design_score|implementation_owners|implementation_reviewers|implementation_score|test_owners|test_reviewers|test_score|)]] = Analysis = == Overview == The goal of this task is to provide the ability for the user to search the content of the book. * The Tools tab has a Search palette. It lets the user search a Sophie book. * A text field is available at the top of the palette where a user can enter a word or phrase he wants to find in current book. * The searching palette in the Tools tab provides a list of results with context (some words before and after the match; also the page number). Typical scenario: * Text is typed in the field at the top of the palette. * Enter is hit. * A list of all occurrences in text are provided in the palette. * All occurrences are highlighted in the text. * To go to one of them, it is clicked in the list. * Clicking on a result displays the page of the book with the match. * The caret is positioned at the beginning of the match. * The match is selected. * Searching should be available in both Author and Reader. == Task requirements == * Add a "Search" button next to the search box in the palette. * Make the list to display all occurrences in text. Each list item should contain: * the page number of the match * a ":" sign * three (or less, if less words are available or if they are longer than 50 chars) words before the match * the match * and three (or less, applying the same rule) words after the match. * If occurrences are more than 100, only first 100 should be displayed. == Task result == * Source code == Implementation idea == * Use {{{LogicR3Button}}} for the button. * Use the {{{firstSelectedItem}}} property in {{{ListPalette}}}. * Extend {{{ListPaletteItem}}} and implement there the logic for displaying a given match. * A hash-search algorithm can be used when searching larger fragments. == Related == * [wiki:SEARCH_COMMONS_R0] - for highlighting == How to demo == * Insert a text frame and write something like "dfjkfds abc jfkdjfslk-abc-fdjfslkdfs" (at least two occurrencies of "abc") * Open the search palette * Search for "abc" = Design = * Create a module {{{org.sophie2.main.func.search}}} * Move the search palette to {{{org.sophie2.main.func.search.view}}} package. * Add new "Search" {{{LogicR3Button}}} to the {{{JComponent}}} in {{{initHead()}}}. = Implementation = ^(Describe and link the implementation results here (from the wiki or the repository).)^ = Testing = ^(Place the testing results here.)^ = Comments = ^(Write comments for this or later revisions here.)