You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2006/10/03 23:31:21 UTC
svn commit: r452634 -
/incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/SearchResultsModel.java
Author: snoopdave
Date: Tue Oct 3 14:31:20 2006
New Revision: 452634
URL: http://svn.apache.org/viewvc?view=rev&rev=452634
Log:
Use TreeMap to keep pages in order
Modified:
incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/SearchResultsModel.java
Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/SearchResultsModel.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/SearchResultsModel.java?view=diff&rev=452634&r1=452633&r2=452634
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/SearchResultsModel.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/SearchResultsModel.java Tue Oct 3 14:31:20 2006
@@ -19,6 +19,7 @@
package org.apache.roller.ui.rendering.model;
import java.io.IOException;
+import java.sql.Timestamp;
import java.util.Date;
import java.util.Map;
import java.util.ResourceBundle;
@@ -166,6 +167,7 @@
WeblogEntryData entry = null;
Document doc = null;
String handle = null;
+ Timestamp now = new Timestamp(new Date().getTime());
for(int i = offset; i < offset+limit; i++) {
entry = null; // reset for each iteration
@@ -191,7 +193,8 @@
// maybe null if search result returned inactive user
// or entry's user is not the requested user.
- if (entry != null) {
+ // but don't return future posts
+ if (entry != null && entry.getPubTime().before(now)) {
addEntryToResults(WeblogEntryDataWrapper.wrap(entry));
}
}
Re: svn commit: r452634 -
/incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/SearchResultsModel.java
Posted by Allen Gilliland <al...@sun.com>.
One thing to note about that fix is that *if* the results include
entries published to future then the # of entries displayed will be
(limit - # of future postings), so you could end up with a shorter
result set than expected.
That's better than returning future postings, but still not perfect.
-- Allen
Dave wrote:
> Oops, wrong comment. That one should have been "prevent future
> postings from showing up in search results"
>
> On 10/3/06, snoopdave@apache.org <sn...@apache.org> wrote:
>> Author: snoopdave
>> Date: Tue Oct 3 14:31:20 2006
>> New Revision: 452634
>>
>> URL: http://svn.apache.org/viewvc?view=rev&rev=452634
>> Log:
>> Use TreeMap to keep pages in order
>>
>> Modified:
>>
>> incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/SearchResultsModel.java
>>
>>
>> Modified:
>> incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/SearchResultsModel.java
>>
>> URL:
>> http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/SearchResultsModel.java?view=diff&rev=452634&r1=452633&r2=452634
>>
>> ==============================================================================
>>
>> ---
>> incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/SearchResultsModel.java
>> (original)
>> +++
>> incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/SearchResultsModel.java
>> Tue Oct 3 14:31:20 2006
>> @@ -19,6 +19,7 @@
>> package org.apache.roller.ui.rendering.model;
>>
>> import java.io.IOException;
>> +import java.sql.Timestamp;
>> import java.util.Date;
>> import java.util.Map;
>> import java.util.ResourceBundle;
>> @@ -166,6 +167,7 @@
>> WeblogEntryData entry = null;
>> Document doc = null;
>> String handle = null;
>> + Timestamp now = new Timestamp(new Date().getTime());
>> for(int i = offset; i < offset+limit; i++) {
>>
>> entry = null; // reset for each iteration
>> @@ -191,7 +193,8 @@
>>
>> // maybe null if search result returned inactive user
>> // or entry's user is not the requested user.
>> - if (entry != null) {
>> + // but don't return future posts
>> + if (entry != null && entry.getPubTime().before(now)) {
>>
>> addEntryToResults(WeblogEntryDataWrapper.wrap(entry));
>> }
>> }
>>
>>
>>
Re: svn commit: r452634 - /incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/SearchResultsModel.java
Posted by Dave <sn...@gmail.com>.
Oops, wrong comment. That one should have been "prevent future
postings from showing up in search results"
On 10/3/06, snoopdave@apache.org <sn...@apache.org> wrote:
> Author: snoopdave
> Date: Tue Oct 3 14:31:20 2006
> New Revision: 452634
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=452634
> Log:
> Use TreeMap to keep pages in order
>
> Modified:
> incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/SearchResultsModel.java
>
> Modified: incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/SearchResultsModel.java
> URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/SearchResultsModel.java?view=diff&rev=452634&r1=452633&r2=452634
> ==============================================================================
> --- incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/SearchResultsModel.java (original)
> +++ incubator/roller/trunk/src/org/apache/roller/ui/rendering/model/SearchResultsModel.java Tue Oct 3 14:31:20 2006
> @@ -19,6 +19,7 @@
> package org.apache.roller.ui.rendering.model;
>
> import java.io.IOException;
> +import java.sql.Timestamp;
> import java.util.Date;
> import java.util.Map;
> import java.util.ResourceBundle;
> @@ -166,6 +167,7 @@
> WeblogEntryData entry = null;
> Document doc = null;
> String handle = null;
> + Timestamp now = new Timestamp(new Date().getTime());
> for(int i = offset; i < offset+limit; i++) {
>
> entry = null; // reset for each iteration
> @@ -191,7 +193,8 @@
>
> // maybe null if search result returned inactive user
> // or entry's user is not the requested user.
> - if (entry != null) {
> + // but don't return future posts
> + if (entry != null && entry.getPubTime().before(now)) {
> addEntryToResults(WeblogEntryDataWrapper.wrap(entry));
> }
> }
>
>
>