cleanup better when switching between AND/OR modes of fulltext search

--HG--
branch : gloda-facet
This commit is contained in:
Andrew Sutherland 2009-09-08 23:05:47 -07:00
Родитель e5ced40544
Коммит a637e61f29
1 изменённых файлов: 16 добавлений и 2 удалений

Просмотреть файл

@ -379,6 +379,7 @@ var FacetContext = {
this.faceters = this.facetDriver.faceters.concat();
this.everFaceted = false;
this._activeConstraints = {};
try {
if (this.searcher) {
this._sortBy = '-dascore';
@ -421,6 +422,18 @@ var FacetContext = {
this.maxMessagesToShow = 10;
},
/**
* Clean up the UI in preparation for a new query to come in.
*/
_resetUI: function() {
for each (let [, faceter] in Iterator(this.faceters)) {
if (faceter.xblNode && !faceter.xblNode.explicit)
faceter.xblNode.parentNode.removeChild(faceter.xblNode);
faceter.xblNode = null;
faceter.constraint = null;
}
},
_groupCountComparator: function(a, b) {
return b.groupCount - a.groupCount;
},
@ -448,7 +461,7 @@ var FacetContext = {
explicitBinding.orderedGroups = faceter.orderedGroups;
// explicit booleans should always be displayed for consistency
if (faceter.groupCount >= 1 ||
faceter.type == "boolean") {
(explicitBinding.getAttribute("type").indexOf("boolean") != -1)) {
explicitBinding.build(true);
explicitBinding.removeAttribute("uninitialized");
}
@ -558,7 +571,7 @@ var FacetContext = {
* Maps attribute names to their corresponding |ActiveConstraint|, if they
* have one.
*/
_activeConstraints: {},
_activeConstraints: null,
/**
* Called by facet bindings when the user does some clicking and wants to
* impose a new constraint.
@ -666,6 +679,7 @@ var FacetContext = {
toggleFulltextCriteria: function() {
this.tab.searcher.andTerms = !this.tab.searcher.andTerms;
this._resetUI();
this.collection = this.tab.searcher.getCollection(this);
},