Index: src/search.c ================================================================== --- src/search.c +++ src/search.c @@ -1031,11 +1031,15 @@ unsigned int srchFlags, /* What to search over */ int fDebug /* Extra debugging output */ ){ Stmt q; int nRow = 0; + int nLimit = db_get_int("search-limit", 100); + if( P("searchlimit")!=0 ){ + nLimit = atoi(P("searchlimit")); + } srchFlags = search_restrict(srchFlags); if( srchFlags==0 ) return 0; search_sql_setup(g.db); add_content_sql_commands(g.db); db_multi_exec( @@ -1045,26 +1049,32 @@ search_fullscan(zPattern, srchFlags); /* Full-scan search */ }else{ search_update_index(srchFlags); /* Update the index, if necessary */ search_indexed(zPattern, srchFlags); /* Indexed search */ } - db_prepare(&q, "SELECT url, snip, label, score, id" + db_prepare(&q, "SELECT url, snip, label, score, id, substr(date,1,10)" " FROM x" " ORDER BY score DESC, date DESC;"); while( db_step(&q)==SQLITE_ROW ){ const char *zUrl = db_column_text(&q, 0); const char *zSnippet = db_column_text(&q, 1); const char *zLabel = db_column_text(&q, 2); + const char *zDate = db_column_text(&q, 5); if( nRow==0 ){ @
    } nRow++; @
  1. %h(zLabel) if( fDebug ){ @ (%e(db_column_double(&q,3)), %s(db_column_text(&q,4)) } - @
    %z(cleanSnippet(zSnippet))

  2. + @
    %z(cleanSnippet(zSnippet)) \ + if( zDate && zDate[0] && strstr(zLabel,zDate)==0 ){ + @ (%h(zDate)) + } + @ + if( nLimit && nRow>=nLimit ) break; } db_finalize(&q); if( nRow ){ @
}