From f03a2a45ea40c9ea72785fe1f9d1108b1ddc0d0f Mon Sep 17 00:00:00 2001 From: Crenshinibon Date: Thu, 19 Sep 2013 20:45:09 +0200 Subject: [PATCH] added methods to disable and enable indexes --- packages/spomet/indexes/custom.coffee | 7 +++++++ packages/spomet/indexes/fullword.coffee | 7 +++++++ packages/spomet/indexes/threegram.coffee | 7 +++++++ packages/spomet/indexes/wordgroup.coffee | 9 ++++++++- 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/packages/spomet/indexes/custom.coffee b/packages/spomet/indexes/custom.coffee index 870faea..f541e9a 100644 --- a/packages/spomet/indexes/custom.coffee +++ b/packages/spomet/indexes/custom.coffee @@ -6,6 +6,13 @@ Spomet.CustomIndex = @CustomIndex Spomet.options.indexes.push @CustomIndex +Meteor.methods + disableCustomIndex: () -> + i = Spomet.options.indexes.indexOf CustomIndex + if i isnt -1 then Spomet.options.indexes.splice i, 1 + enableCustomIndex: () -> + Spomet.options.indexes.push CustomIndex + class @CustomIndex.Tokenizer indexName: CustomIndex.name index: CustomIndex diff --git a/packages/spomet/indexes/fullword.coffee b/packages/spomet/indexes/fullword.coffee index e04e7cd..cfcdd48 100644 --- a/packages/spomet/indexes/fullword.coffee +++ b/packages/spomet/indexes/fullword.coffee @@ -6,6 +6,13 @@ Spomet.FullWordIndex = @FullWordIndex Spomet.options.indexes.push @FullWordIndex +Meteor.methods + disableFullWordIndex: () -> + i = Spomet.options.indexes.indexOf FullWordIndex + if i isnt -1 then Spomet.options.indexes.splice i, 1 + enableFullWordIndex: () -> + Spomet.options.indexes.push FullWordIndex + class @FullWordIndex.Tokenizer indexName: FullWordIndex.name index: FullWordIndex diff --git a/packages/spomet/indexes/threegram.coffee b/packages/spomet/indexes/threegram.coffee index 4dd0432..622877e 100644 --- a/packages/spomet/indexes/threegram.coffee +++ b/packages/spomet/indexes/threegram.coffee @@ -6,6 +6,13 @@ Spomet.ThreeGramIndex = @ThreeGramIndex Spomet.options.indexes.push @ThreeGramIndex +Meteor.methods + disableThreeGramIndex: () -> + i = Spomet.options.indexes.indexOf ThreeGramIndex + if i isnt -1 then Spomet.options.indexes.splice i, 1 + enableThreeGramIndex: () -> + Spomet.options.indexes.push ThreeGramIndex + class @ThreeGramIndex.Tokenizer indexName: ThreeGramIndex.name index: ThreeGramIndex diff --git a/packages/spomet/indexes/wordgroup.coffee b/packages/spomet/indexes/wordgroup.coffee index 5bf7466..e5cae39 100644 --- a/packages/spomet/indexes/wordgroup.coffee +++ b/packages/spomet/indexes/wordgroup.coffee @@ -5,7 +5,14 @@ Spomet.WordGroupIndex = @WordGroupIndex Spomet.options.indexes.push @WordGroupIndex - + +Meteor.methods + disableWordGroupIndex: () -> + i = Spomet.options.indexes.indexOf WordGroupIndex + if i isnt -1 then Spomet.options.indexes.splice i, 1 + enableWordGroupIndex: () -> + Spomet.options.indexes.push WordGroupIndex + class @WordGroupIndex.Tokenizer indexName: WordGroupIndex.name index: WordGroupIndex