[Add support for searching for ranges and the more button
Neil Mitchell**20080805132947] {
hunk ./src/Web/Action.hs 70
-runQuery dbs CmdQuery{query = Right q} =
+runQuery dbs cq@CmdQuery{query = Right q, queryFlags = flags} =
hunk ./src/Web/Action.hs 75
- else
- ["
"] ++ concatMap renderRes res ++ ["
"]
+ else -- error $ show (length res, length pre, length now, length post) -
+ [""] ++
+ concatMap renderRes pre ++
+ insertMore (concatMap renderRes now) ++
+ [moreResults | not $ null post] ++
+ ["
"]
hunk ./src/Web/Action.hs 82
- res = searchRange (rangeStartCount 0 25) dbs q
+ start = headDef 0 [i-1 | Start i <- flags]
+ count = headDef 20 [n | Count n <- flags]
+ res = searchRange (rangeStartCount 0 (start+count+1)) dbs q
+ (pre,res2) = splitAt start res
+ (now,post) = splitAt count res2
+
+ moreResults = " | Show more results |
"
+ urlMore = "?q=" +% queryText cq ++ "&start=" ++ show (start+count+1) ++ "#more"
hunk ./src/Web/Action.hs 97
+-- insert where you can
+insertMore :: [String] -> [String]
+insertMore [] = []
+insertMore (x:xs) = f x : xs
+ where
+ f ('>':xs) | not $ " |