Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c33c5746 authored by Thiru Ramasamy's avatar Thiru Ramasamy
Browse files

[OneSearch] Add direct_match to SearchAttributes.

Captures if user acted on a search result that is not directly matched with search query, but instead related/suggested result.

Bug: 199495917
Test: Manual - http://gpaste/5167163338915840
Change-Id: Ib38244b1a82c502f551e8eb24dd14c14d8b375f2
parent 441461c9
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -39,5 +39,8 @@ message DeviceSearchResultContainer{

    // True if results are based on spell corrected query
    optional bool corrected_query = 1;

    // True if the item's title/content is a direct match to the search query, false otherwise.
    optional bool direct_match = 2;
  }
}
+4 −0
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ public class StatsLogCompatManager extends StatsLogManager {
     * Flags for converting SearchAttribute to integer value.
     */
    private static final int SEARCH_ATTRIBUTES_CORRECTED_QUERY = 1;
    private static final int SEARCH_ATTRIBUTES_DIRECT_MATCH = 1 << 1;

    public static final CopyOnWriteArrayList<StatsLogConsumer> LOGS_CONSUMER =
            new CopyOnWriteArrayList<>();
@@ -584,6 +585,9 @@ public class StatsLogCompatManager extends StatsLogManager {
        if (searchAttributes.getCorrectedQuery()) {
            response = response | SEARCH_ATTRIBUTES_CORRECTED_QUERY;
        }
        if (searchAttributes.getDirectMatch()) {
            response = response | SEARCH_ATTRIBUTES_DIRECT_MATCH;
        }
        return response;
    }