3 class SearchResultsMode < ThreadIndexMode
10 k.add :refine_search, "Refine search", '|'
14 text = BufferManager.ask :search, "refine query: ", (@query[:text] + " ")
15 return unless text && text !~ /^\s*$/
16 SearchResultsMode.spawn_from_query text
19 ## a proper is_relevant? method requires some way of asking ferret
20 ## if an in-memory object satisfies a query. i'm not sure how to do
21 ## that yet. in the worst case i can make an in-memory index, add
22 ## the message, and search against it to see if i have > 0 results,
23 ## but that seems pretty insane.
25 def self.spawn_from_query text
27 query = Index.parse_query(text)
29 short_text = text.length < 20 ? text : text[0 ... 20] + "..."
30 mode = SearchResultsMode.new query
31 BufferManager.spawn "search: \"#{short_text}\"", mode
32 mode.load_threads :num => mode.buffer.content_height
33 rescue Index::ParseError => e
34 BufferManager.flash "Problem: #{e.message}!"