When I call getDeviceForRequest, how can I know if the result is a conclusive match, or "guess"?
(I need to log this status in order be able to better analyze bugs in our system, and to manage our patches).
Thanks,
Hagai
Getting WURFL match status (exact/recovery)
Re: Getting WURFL match status (exact/recovery)
In the meanwhile I used this:
Code: Select all
if (givenUA.equals(matchedUA)) {
log.debug("WURFL found exact match for: " + givenUA);
}
else {
int levenshteinDistance = StringUtils.getLevenshteinDistance(givenUA, matchedUA);
boolean isPrefix = givenUA.startsWith(matchedUA);
log.debug(String.format("WURFL found approximate match for: %s, found: %s, isPrefix: %b, levenshteinDistance: %d",
givenUA, matchedUA, isPrefix, levenshteinDistance) );
}
-
- Posts: 65
- Joined: Thu May 19, 2011 2:49 pm
Re: Getting WURFL match status (exact/recovery)
Hi there.
Actually there is a simple trick that you can use. If the ID of the matched device contains the "generic" string, it means that the match happened through a recovery strategy.
Please let me know if this helps
Luca
Actually there is a simple trick that you can use. If the ID of the matched device contains the "generic" string, it means that the match happened through a recovery strategy.
Please let me know if this helps
Luca
Re: Getting WURFL match status (exact/recovery)
So if I understand correctly:
If the detected device UA equals the given UA then we can also assume the device id will not contain "generic".
It's possible to get a *"conclusive"* match of a given UA with a non-equal device UA, and in that case the device id will also not contain "generic".
The device ID contains "generic" if and only if a "recovery strategy" was used.
If the detected device UA equals the given UA then we can also assume the device id will not contain "generic".
It's possible to get a *"conclusive"* match of a given UA with a non-equal device UA, and in that case the device id will also not contain "generic".
The device ID contains "generic" if and only if a "recovery strategy" was used.
Code: Select all
if (givenUA.equals(matchedUA)) {
// conclusive - exact (maybe no need to check this because "generic" is the only needed test???)
}
else if (!wurflDevice.getId().contains("generic")) {
// conclusive - approx
}
else {
// recovered
}
-
- Posts: 65
- Joined: Thu May 19, 2011 2:49 pm
Re: Getting WURFL match status (exact/recovery)
if I understand what you are asking correctly, the answer is that comparing the UA string in WURFL to the UA you got from the HTTP reuqest is not very significant, because the API applies all kinds of normalization and cleaning logic to identify a device no matter what the language locale and minor firmware variations are. So, the UAs may not match exactly, but still it was the conclusive heuristic that did the job of finding a match.
And yes, if a device ID contains "generic", it means that the match was obtained through a 'recovery heuristic'.
If you find an instance where this is not the case, please let us know because we would treat that as a bug.
One advantage of this approach is that you can easily analyse your logs offline (assuming you log the WURFL ID). Just grep for "generic"
Thanks
Luca
And yes, if a device ID contains "generic", it means that the match was obtained through a 'recovery heuristic'.
If you find an instance where this is not the case, please let us know because we would treat that as a bug.
One advantage of this approach is that you can easily analyse your logs offline (assuming you log the WURFL ID). Just grep for "generic"
Thanks
Luca
-
- Posts: 65
- Joined: Thu May 19, 2011 2:49 pm
Re: Getting WURFL match status (exact/recovery)
This post actually inspired our Java engineer to a simple but nice addition to our API. Stay tuned.
Luca
Luca
Who is online
Users browsing this forum: No registered users and 77 guests