Filter out 'my' identities from the involves facet.
--HG-- branch : gloda-facet extra : rebase_source : b5289188ef7371ddd74f02d837d035b3b4fbfea4
This commit is contained in:
Родитель
6ecf8bbdb0
Коммит
b9100e6829
|
@ -238,6 +238,7 @@ DiscreteFaceter.prototype = {
|
|||
facetPrimitiveItems: function(aItems) {
|
||||
let attrKey = this.attrDef.boundName;
|
||||
let nounDef = this.attrDef.objectNounDef;
|
||||
let filter = this.attrDef.facet.filter;
|
||||
|
||||
let valStrToVal = {};
|
||||
let groups = this.groups = {};
|
||||
|
@ -245,6 +246,11 @@ DiscreteFaceter.prototype = {
|
|||
|
||||
for each (let [, item] in Iterator(aItems)) {
|
||||
let val = (attrKey in item) ? item[attrKey] : null;
|
||||
|
||||
// skip items the filter tells us to ignore
|
||||
if (filter && !filter(val))
|
||||
continue;
|
||||
|
||||
if (val in groups)
|
||||
groups[val].push(item);
|
||||
else {
|
||||
|
@ -271,6 +277,7 @@ DiscreteFaceter.prototype = {
|
|||
facetComplexItems: function(aItems) {
|
||||
let attrKey = this.attrDef.boundName;
|
||||
let nounDef = this.attrDef.objectNounDef;
|
||||
let filter = this.attrDef.facet.filter;
|
||||
let idAttr = this.attrDef.facet.groupIdAttr;
|
||||
|
||||
let groups = this.groups = {};
|
||||
|
@ -279,6 +286,11 @@ DiscreteFaceter.prototype = {
|
|||
|
||||
for each (let [, item] in Iterator(aItems)) {
|
||||
let val = (attrKey in item) ? item[attrKey] : null;
|
||||
|
||||
// skip items the filter tells us to ignore
|
||||
if (filter && !filter(val))
|
||||
continue;
|
||||
|
||||
let valId = (val == null) ? null : val[idAttr];
|
||||
if (valId in groupMap) {
|
||||
groups[valId].push(item);
|
||||
|
@ -330,6 +342,7 @@ DiscreteSetFaceter.prototype = {
|
|||
facetPrimitiveItems: function(aItems) {
|
||||
let attrKey = this.attrDef.boundName;
|
||||
let nounDef = this.attrDef.objectNounDef;
|
||||
let filter = this.attrDef.facet.filter;
|
||||
|
||||
let groups = this.groups = {};
|
||||
let valStrToVal = {};
|
||||
|
@ -341,6 +354,10 @@ DiscreteSetFaceter.prototype = {
|
|||
vals = [null];
|
||||
}
|
||||
for each (let [, val] in Iterator(vals)) {
|
||||
// skip items the filter tells us to ignore
|
||||
if (filter && !filter(val))
|
||||
continue;
|
||||
|
||||
if (val in groups)
|
||||
groups[val].push(item);
|
||||
else {
|
||||
|
@ -368,6 +385,7 @@ DiscreteSetFaceter.prototype = {
|
|||
facetComplexItems: function(aItems) {
|
||||
let attrKey = this.attrDef.boundName;
|
||||
let nounDef = this.attrDef.objectNounDef;
|
||||
let filter = this.attrDef.facet.filter;
|
||||
let idAttr = this.attrDef.facet.groupIdAttr;
|
||||
|
||||
let groups = this.groups = {};
|
||||
|
@ -380,6 +398,10 @@ DiscreteSetFaceter.prototype = {
|
|||
vals = [null];
|
||||
}
|
||||
for each (let [, val] in Iterator(vals)) {
|
||||
// skip items the filter tells us to ignore
|
||||
if (filter && !filter(val))
|
||||
continue;
|
||||
|
||||
let valId = (val == null) ? null : val[idAttr];
|
||||
if (valId in groupMap) {
|
||||
groups[valId].push(item);
|
||||
|
|
|
@ -94,7 +94,7 @@ var GlodaFundAttr = {
|
|||
/** Boost for each additional person involved in my address book. */
|
||||
NOTABILITY_INVOLVING_ADDR_BOOK_ADDL: 2,
|
||||
|
||||
defineAttributes: function() {
|
||||
defineAttributes: function gloda_explattr_defineAttributes() {
|
||||
/* ***** Conversations ***** */
|
||||
// conversation: subjectMatches
|
||||
this._attrConvSubject = Gloda.defineAttribute({
|
||||
|
@ -326,7 +326,19 @@ var GlodaFundAttr = {
|
|||
attributeType: Gloda.kAttrOptimization,
|
||||
attributeName: "involves",
|
||||
singular: false,
|
||||
facet: true,
|
||||
facet: {
|
||||
type: "default",
|
||||
/**
|
||||
* Filter out 'me', as we have other facets that deal with that, and the
|
||||
* 'me' identities are so likely that they distort things.
|
||||
*
|
||||
* @return true if the identity is not one of my identities, false if it
|
||||
* is.
|
||||
*/
|
||||
filter: function gloda_explattr_involves_filter(aItem) {
|
||||
return (!(aItem.id in Gloda.myIdentities));
|
||||
}
|
||||
},
|
||||
subjectNouns: [Gloda.NOUN_MESSAGE],
|
||||
objectNoun: Gloda.NOUN_IDENTITY,
|
||||
}); // not-tested
|
||||
|
|
|
@ -1560,12 +1560,15 @@ var Gloda = {
|
|||
if (aAttrDef.facet == true) {
|
||||
aAttrDef.facet = {
|
||||
type: "default",
|
||||
groupIdAttr: aAttrDef.objectNounDef.idAttr
|
||||
groupIdAttr: aAttrDef.objectNounDef.idAttr,
|
||||
filter: null,
|
||||
};
|
||||
}
|
||||
else {
|
||||
if (!("groupIdAttr" in aAttrDef.facet))
|
||||
aAttrDef.facet.groupIdAttr = aAttrDef.objectNounDef.idAttr;
|
||||
if (!("filter" in aAttrDef.facet))
|
||||
aAttrDef.facet.filter = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче