~stolowski/unity-lens-applications/fuzzy-public-content

« back to all changes in this revision

Viewing changes to src/unity-package-search.cc

  • Committer: Tarmac
  • Author(s): Automatic PS uploader, Mathieu Trudel-Lapierre, Jussi Pakkanen, Sebastien Bacher, Michal Hruby
  • Date: 2013-04-16 14:06:01 UTC
  • mfrom: (337.1.1 unity-lens-applications)
  • Revision ID: tarmac-20130416140601-nz2bmzulbxebc6aw
Merge trunk.

Approved by Pawel Stolowski, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
        std::string val;
97
97
 
98
98
        val = xdoc.get_value(XAPIAN_VALUE_APPNAME);
99
 
        if(!val.empty())
 
99
        if(!val.empty()) {
100
100
            cdoc.addText(appnameField, val.c_str());
 
101
        }
 
102
        /* It turned out that fuzzy matching non-visible content
 
103
         * is confusing to users, so let's not index these at all.
 
104
         * In the future we might want to explore better ways
 
105
         * of exposing this info.
101
106
        val = xdoc.get_value(XAPIAN_VALUE_SUMMARY);
102
 
        if(!val.empty())
 
107
        if(!val.empty()) {
103
108
            cdoc.addText(summaryField, val.c_str());
 
109
        }
104
110
        val = xdoc.get_value(XAPIAN_VALUE_PKGNAME);
105
 
        if(!val.empty())
 
111
        if(!val.empty()) {
106
112
            cdoc.addText(pkgnameField, val.c_str());
 
113
        }
 
114
        */
107
115
        val = xdoc.get_value(XAPIAN_VALUE_EXENAME);
108
 
        if(!val.empty())
 
116
        if(!val.empty()) {
109
117
            cdoc.addText(exenameField, val.c_str());
 
118
        }
110
119
        c.addDocument(cdoc);
111
120
    }
112
121
    m->index(c);
113
122
    m->getErrorValues().addStandardErrors();
114
 
    m->getErrorValues().setSubstringMode();
 
123
    // Substring mode resulted in too many false positives,
 
124
    // so disable it for the time being.
 
125
    //m->getErrorValues().setSubstringMode();
115
126
    m->getIndexWeights().setWeight(summaryField, 0.5);
116
127
}
117
128
 
638
649
  if (g_slist_length(xap_result->results) == 0 && (!is_filtered && col_query_str)) {
639
650
      g_slice_free(UnityPackageSearchResult, xap_result);
640
651
      col_query_str += 3;
641
 
      return libcolumbus_search(searcher, col_query_str);
 
652
      UnityPackageSearchResult *res = libcolumbus_search(searcher, col_query_str);
 
653
      return res;
642
654
  }
643
655
  return xap_result;
644
656
}