- add number of search results to end of rss and json output to reflect latest status of retrieval

- distinguish search access with different verify state in access of search cache

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7965 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 14 years ago
parent 87e6abd168
commit 6b02b696b0

@ -30,6 +30,7 @@ import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.ranking.ScoreMap;
import net.yacy.document.LibraryProvider;
import net.yacy.kelondro.util.EventTracker;
import net.yacy.kelondro.util.Formatter;
import de.anomic.search.QueryParams;
import de.anomic.search.SearchEvent;
import de.anomic.search.SearchEventCache;
@ -239,6 +240,9 @@ public class yacysearchtrailer {
prop.put("cat-location_query", theQuery.queryString(true));
prop.put("cat-location_queryenc", theQuery.queryString(true).replace(' ', '+'));
}
final int indexcount = theSearch.getRankingResult().getLocalIndexCount() - theSearch.getRankingResult().getMissCount() - theSearch.getRankingResult().getSortOutCount() + theSearch.getRankingResult().getRemoteIndexCount();
prop.put("num-results_totalcount", Formatter.number(indexcount, true));
EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.EventSearch(theQuery.id(true), SearchEvent.Type.FINALIZATION, "bottomline", 0, 0), false);

@ -77,4 +77,5 @@
#{/element}#
]
}#(/nav-topics)#
]
],
"totalResults": "#[num-results_totalcount]#"

@ -42,4 +42,5 @@
</yacy:facet>
#(/nav-topics)#
</yacy:navigation>
<opensearch:totalResults>#[num-results_totalcount]#</opensearch:totalResults>

@ -467,6 +467,8 @@ public final class QueryParams {
context.append(this.constraint);
context.append(asterisk);
context.append(this.maxDistance);
context.append(asterisk);
context.append(this.snippetCacheStrategy == null ? "null" : this.snippetCacheStrategy.name());
if (anonymized) {
this.idCacheAnon = context.toString();
} else {

@ -160,6 +160,10 @@ public class serverObjects extends HashMap<String, String> implements Cloneable
* @return the modified String that was added to the map.
*/
public String putJSON(final String key, String value) {
return put(key, toJSON(value));
}
private static String toJSON(String value) {
// value = value.replaceAll("\\", "\\\\");
value = patternDoublequote.matcher(value).replaceAll("'");
value = patternSlash.matcher(value).replaceAll("\\/");
@ -168,7 +172,7 @@ public class serverObjects extends HashMap<String, String> implements Cloneable
value = patternNewline.matcher(value).replaceAll("\\r");
value = patternR.matcher(value).replaceAll("\\r");
value = patternT.matcher(value).replaceAll("\\t");
return put(key, value);
return value;
}
public String putJSON(final String key, final byte[] value) {
@ -383,4 +387,9 @@ public class serverObjects extends HashMap<String, String> implements Cloneable
return param.toString();
}
public static void main(String[] args) {
String v = "ein \"zitat\"";
System.out.println(toJSON(v));
}
}

@ -76,6 +76,7 @@ public enum CacheStrategy {
if (name.equals("iffresh")) return IFFRESH;
if (name.equals("ifexist")) return IFEXIST;
if (name.equals("cacheonly")) return CACHEONLY;
if (name.equals("nifty")) return NIFTY;
if (name.equals("true")) return IFEXIST;
if (name.equals("false")) return null; // if this cache strategy is assigned as query attribute, null means "do not create a snippet"
return null;

Loading…
Cancel
Save