added user agent logging to access tracker

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7256 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 14 years ago
parent 61e87c0b14
commit 863065abc4

@ -79,6 +79,7 @@
<td>URL fetch (ms)</td>
<td>Snippet comp (ms)</td>
<td>Query</td>
<td>User Agent</td>
</tr>
</thead>
<tbody>
@ -93,6 +94,7 @@
<td>#[urltime]#</td>
<td>#[snippettime]#</td>
<td><a href="/yacysearch.html?query=#[querystring]#&resource=local">#[querystring]#</a></td>
<td>#[userAgent]#</td>
</tr>
#{/list}#
</tbody>
@ -107,6 +109,7 @@
<td>&#216; #[urltime_avg]#</td>
<td>&#216; #[snippettime_avg]#</td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>

@ -176,6 +176,7 @@ public class AccessTracker_p {
prop.putNum("page_list_" + entCount + "_urltime", searchProfile.urlretrievaltime);
prop.putNum("page_list_" + entCount + "_snippettime", searchProfile.snippetcomputationtime);
prop.putNum("page_list_" + entCount + "_resulttime", searchProfile.searchtime);
prop.putHTML("page_list_" + entCount + "_userAgent", searchProfile.userAgent);
qcountSum += searchProfile.itemsPerPage;
rcountSum += searchProfile.resultcount;
utimeSum += searchProfile.urlretrievaltime;

@ -26,11 +26,11 @@
<offset>#[offset]#</offset>
<querycount>#[querycount]#</querycount>
<resultcount>#[resultcount]#</resultcount>
<querytime>#[querytime]#</querytime>
<resulttime>#[resulttime]#</resulttime>
<urltime>#[urltime]#</urltime>
<snippettime>#[snippettime]#</snippettime>
<querystring>#[querystring]#</querystring>
<querystring>#[querystring]#</querystring>
<useragent>#[userAgent]#</useragent>
</entry>
#{/list}#</localSearchLog>

@ -517,7 +517,7 @@ public class IndexControlRWIs_p {
}
public static RankingProcess genSearchresult(final serverObjects prop, final Switchboard sb, Segment segment, final byte[] keyhash, final Bitfield filter) {
final QueryParams query = new QueryParams(new String(keyhash), -1, filter, segment, sb.getRanking());
final QueryParams query = new QueryParams(new String(keyhash), -1, filter, segment, sb.getRanking(), "IndexControlRWIs_p");
final ReferenceOrder order = new ReferenceOrder(query.ranking, query.targetlang);
final RankingProcess ranked = new RankingProcess(query, order, Integer.MAX_VALUE);
ranked.run();

@ -223,7 +223,8 @@ public final class search {
client,
false,
indexSegment,
rankingProfile
rankingProfile,
header.get(RequestHeader.USER_AGENT, "")
);
yacyCore.log.logInfo("INIT HASH SEARCH (abstracts only): " + QueryParams.anonymizedQueryHashes(theQuery.queryHashes) + " - " + theQuery.displayResults() + " links");
@ -276,7 +277,8 @@ public final class search {
client,
false,
sb.indexSegments.segment(Segments.Process.PUBLIC),
rankingProfile
rankingProfile,
header.get(RequestHeader.USER_AGENT, "")
);
yacyCore.log.logInfo("INIT HASH SEARCH (query-" + abstracts + "): " + QueryParams.anonymizedQueryHashes(theQuery.queryHashes) + " - " + theQuery.displayResults() + " links");
yacyChannel.channels(yacyChannel.REMOTESEARCH).addMessage(new RSSMessage("Remote Search Request from " + ((remoteSeed == null) ? "unknown" : remoteSeed.getName()), QueryParams.anonymizedQueryHashes(theQuery.queryHashes), ""));

@ -491,7 +491,8 @@ public class yacysearch {
client,
authenticated,
indexSegment,
ranking);
ranking,
header.get(RequestHeader.USER_AGENT, ""));
EventTracker.delete(EventTracker.EClass.SEARCH);
EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.searchEvent(theQuery.id(true), SearchEvent.Type.INITIALIZATION, "", 0, 0), false);

@ -189,7 +189,7 @@ public class DocumentIndex extends Segment {
*/
public ArrayList<DigestURI> find(String querystring, int count) {
// make a query and start a search
QueryParams query = new QueryParams(querystring, count, null, this, textRankingDefault);
QueryParams query = new QueryParams(querystring, count, null, this, textRankingDefault, "DocumentIndex");
ReferenceOrder order = new ReferenceOrder(query.ranking, query.targetlang);
RankingProcess rankedCache = new RankingProcess(query, order, SearchEvent.max_results_preparation);
rankedCache.start();

@ -100,12 +100,14 @@ public final class QueryParams {
public int resultcount; // number of found results
public long searchtime, urlretrievaltime, snippetcomputationtime; // time to perform the search, to get all the urls, and to compute the snippets
public boolean specialRights; // is true if the user has a special authorization and my use more database-extensive options
public final String userAgent;
public QueryParams(final String queryString,
final int itemsPerPage,
final Bitfield constraint,
final Segment indexSegment,
final RankingProfile ranking) {
final RankingProfile ranking,
final String userAgent) {
if ((queryString.length() == 12) && (Base64Order.enhancedCoder.wellformed(queryString.getBytes()))) {
this.queryString = null;
@ -148,6 +150,7 @@ public final class QueryParams {
this.specialRights = false;
this.navigators = "all";
this.indexSegment = indexSegment;
this.userAgent = userAgent;
}
public QueryParams(
@ -168,7 +171,8 @@ public final class QueryParams {
final String host,
final boolean specialRights,
final Segment indexSegment,
final RankingProfile ranking) {
final RankingProfile ranking,
final String userAgent) {
this.queryString = queryString;
this.queryHashes = queryHashes;
@ -200,6 +204,7 @@ public final class QueryParams {
this.handle = Long.valueOf(System.currentTimeMillis());
this.specialRights = specialRights;
this.indexSegment = indexSegment;
this.userAgent = userAgent;
}
public Segment getSegment() {

@ -38,6 +38,7 @@ public class RequestHeader extends HeaderFramework {
public static final String CONNECTION = "Connection";
public static final String PROXY_CONNECTION = "Proxy-Connection";
public static final String KEEP_ALIVE = "Keep-Alive";
public static final String USER_AGENT = "User-Agent";
public static final String AUTHORIZATION = "Authorization";
public static final String WWW_AUTHENTICATE = "WWW-Authenticate";

Loading…
Cancel
Save