Skip to content

Commit

Permalink
fix indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
kiy0taka committed Aug 5, 2010
1 parent 066e004 commit a9283d5
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 40 deletions.
11 changes: 9 additions & 2 deletions war/WEB-INF/appengine-generated/datastore-indexes-auto.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
<!-- Indices written at Wed, 4 Aug 2010 11:40:36 UTC -->
<!-- Indices written at Thu, 5 Aug 2010 14:48:40 UTC -->

<datastore-indexes/>
<datastore-indexes>

<!-- Used 8 times in query history -->
<datastore-index kind="gist" ancestor="false" source="auto">
<property name="extensions" direction="asc"/>
<property name="gistNo" direction="desc"/>
</datastore-index>

</datastore-indexes>
13 changes: 8 additions & 5 deletions war/WEB-INF/datastore-indexes.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<datastore-indexes autoGenerate="true">
<datastore-index kind="gist" ancestor="false" source="auto">
<property name="extensions" direction="asc"/>
<property name="dateCreated" direction="desc"/>
<property name="files" direction="asc"/>
</datastore-index>
<datastore-index kind="gist" ancestor="false" source="auto">
<property name="extensions" direction="asc"/>
<property name="dateCreated" direction="desc"/>
</datastore-index>
<datastore-index kind="gist" ancestor="false" source="auto">
<property name="files" direction="asc"/>
<property name="dateCreated" direction="desc"/>
</datastore-index>
</datastore-indexes>
4 changes: 2 additions & 2 deletions war/WEB-INF/groovy/gist/atom.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import groovy.xml.MarkupBuilder
import java.text.SimpleDateFormat

def isoTime = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US)
def gists = memcache[params.extension ?: params.q]
def gists = memcache[params.extension ?: "q=${params.q}"]
if (gists == null) {
System.out.println "Missing from memcache. [${params.extension ?: params.q}]"
gists = memcache[params.extension ?: params.q] = datastore.prepare(new Query('gist')
gists = memcache[params.extension ?: "q=${params.q}"] = datastore.prepare(new Query('gist')
.addSort('dateCreated', DESCENDING)
.addFilter(params.extension ? 'extensions' : 'files', EQUAL, params.extension ?: params.q)).asList(withLimit(20))
}
Expand Down
4 changes: 2 additions & 2 deletions war/WEB-INF/includes/header.gtpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<div id="header">
<h1>
<a href="/" style="color:#D33381">Gist Feed</a>
<form style="float:right; padding:20px 10px 0px 0px" action="/gist/list" method="get">
<form style="float:right; padding:20px 10px 0px 0px; margin:0px" action="/gist/list" method="get">
<input name="q" type="text" size="30" placeholder="File name search"/>
</form>
</h1>
</div>
<div>
<div style="clear: both;">
29 changes: 2 additions & 27 deletions war/extension/list.gtpl
Original file line number Diff line number Diff line change
Expand Up @@ -34,33 +34,8 @@ div.gist-data {
</style>
</head>
<% include '/WEB-INF/includes/header.gtpl' %>
<ul class="index">
<li><a href="/extensions/index/a">&nbsp;a&nbsp;</a>
<li><a href="/extensions/index/b">&nbsp;b&nbsp;</a>
<li><a href="/extensions/index/c">&nbsp;c&nbsp;</a>
<li><a href="/extensions/index/d">&nbsp;d&nbsp;</a>
<li><a href="/extensions/index/e">&nbsp;e&nbsp;</a>
<li><a href="/extensions/index/f">&nbsp;f&nbsp;</a>
<li><a href="/extensions/index/g">&nbsp;g&nbsp;</a>
<li><a href="/extensions/index/h">&nbsp;h&nbsp;</a>
<li><a href="/extensions/index/i">&nbsp;i&nbsp;</a>
<li><a href="/extensions/index/j">&nbsp;j&nbsp;</a>
<li><a href="/extensions/index/k">&nbsp;k&nbsp;</a>
<li><a href="/extensions/index/l">&nbsp;l&nbsp;</a>
<li><a href="/extensions/index/m">&nbsp;m&nbsp;</a>
<li><a href="/extensions/index/n">&nbsp;n&nbsp;</a>
<li><a href="/extensions/index/o">&nbsp;o&nbsp;</a>
<li><a href="/extensions/index/p">&nbsp;p&nbsp;</a>
<li><a href="/extensions/index/q">&nbsp;q&nbsp;</a>
<li><a href="/extensions/index/r">&nbsp;r&nbsp;</a>
<li><a href="/extensions/index/s">&nbsp;s&nbsp;</a>
<li><a href="/extensions/index/t">&nbsp;t&nbsp;</a>
<li><a href="/extensions/index/u">&nbsp;u&nbsp;</a>
<li><a href="/extensions/index/v">&nbsp;v&nbsp;</a>
<li><a href="/extensions/index/w">&nbsp;w&nbsp;</a>
<li><a href="/extensions/index/x">&nbsp;x&nbsp;</a>
<li><a href="/extensions/index/y">&nbsp;y&nbsp;</a>
<li><a href="/extensions/index/z">&nbsp;z&nbsp;</a>
<ul class="index"><% ('a'..'z').each { %>
<li><a href="/extensions/index/${it}">&nbsp;${it}&nbsp;</a><% } %>
</ul>
<ul style="margin-left:30px;" class="autopagerize_page_element">
<% request.extensions.each { extension -> %>
Expand Down
8 changes: 6 additions & 2 deletions war/gist/list.gtpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<body>
<% include '/WEB-INF/includes/header.gtpl' %>

<% if (request.gists) { %>
<div style="width: 600px; margin-left: 20px; border:3px solid silver" class="autopagerize_page_element">
<% request.gists.each { gist -> %>
<div style='border-top: 1px solid silver; margin-top:-3px;'>
Expand All @@ -33,14 +34,17 @@
</div>
<% } %>
</div>
<% } else { %>
<p style="margin:5px 0px 0px 40px">No Gists.</p>
<% } %>
<div style="margin:10px" class="autopagerize_insert_before">
<% if (request.hasPrev) { %>
<a href="/gist${params.extension?"/"+params.extension:""}/list?prev=${request.gists[0].gistNo}">« Prev</a>
<a href="/gist${params.extension?"/"+params.extension:""}/list?${params.q?"q="+params.q+"&":""}prev=${request.gists[0].gistNo}">« Prev</a>
<% } else { %>
<span style="color:silver">« Prev</span>
<% } %>
<% if (request.hasNext) { %>
<a href="/gist${params.extension?"/"+params.extension:""}/list?next=${request.gists[-1].gistNo}" rel="next">Next »</a>
<a href="/gist${params.extension?"/"+params.extension:""}/list?${params.q?"q="+params.q+"&":""}next=${request.gists[-1].gistNo}" rel="next">Next »</a>
<% } else { %>
<span style="color:silver">Next »</span>
<% } %>
Expand Down

0 comments on commit a9283d5

Please sign in to comment.