diff --git a/analysis/analyzers/detect_lang_analyzer/detect_lang_analyzer.go b/analysis/analyzers/detect_lang_analyzer/detect_lang_analyzer.go index fe623ece..8a43a477 100644 --- a/analysis/analyzers/detect_lang_analyzer/detect_lang_analyzer.go +++ b/analysis/analyzers/detect_lang_analyzer/detect_lang_analyzer.go @@ -6,18 +6,23 @@ // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, // either express or implied. See the License for the specific language governing permissions // and limitations under the License. + +// +build cld2 + package detect_lang_analyzer import ( "github.com/couchbaselabs/bleve/analysis" + "github.com/couchbaselabs/bleve/analysis/token_filters/cld2" "github.com/couchbaselabs/bleve/analysis/token_filters/lower_case_filter" + "github.com/couchbaselabs/bleve/analysis/tokenizers/single_token" "github.com/couchbaselabs/bleve/registry" ) const Name = "detect_lang" func AnalyzerConstructor(config map[string]interface{}, cache *registry.Cache) (*analysis.Analyzer, error) { - keywordTokenizer, err := cache.TokenizerNamed("single") + keywordTokenizer, err := cache.TokenizerNamed(single_token.Name) if err != nil { return nil, err } @@ -25,7 +30,7 @@ func AnalyzerConstructor(config map[string]interface{}, cache *registry.Cache) ( if err != nil { return nil, err } - detectLangFilter, err := cache.TokenFilterNamed("detect_lang") + detectLangFilter, err := cache.TokenFilterNamed(cld2.Name) if err != nil { return nil, err } diff --git a/analysis/token_filters/cld2/cld2_filter.go b/analysis/token_filters/cld2/cld2_filter.go index 4da3ebe1..68594eab 100644 --- a/analysis/token_filters/cld2/cld2_filter.go +++ b/analysis/token_filters/cld2/cld2_filter.go @@ -6,6 +6,9 @@ // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, // either express or implied. See the License for the specific language governing permissions // and limitations under the License. + +// +build cld2 + package cld2 // #cgo LDFLAGS: -lcld2_full diff --git a/analysis/token_filters/cld2/cld2_filter_test.go b/analysis/token_filters/cld2/cld2_filter_test.go index 193ce985..45ace03d 100644 --- a/analysis/token_filters/cld2/cld2_filter_test.go +++ b/analysis/token_filters/cld2/cld2_filter_test.go @@ -6,6 +6,9 @@ // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, // either express or implied. See the License for the specific language governing permissions // and limitations under the License. + +// +build cld2 + package cld2 import ( diff --git a/config.go b/config.go index f93375fb..88d4821f 100644 --- a/config.go +++ b/config.go @@ -20,14 +20,12 @@ import ( _ "github.com/couchbaselabs/bleve/analysis/char_filters/zero_width_non_joiner" // analyzers - _ "github.com/couchbaselabs/bleve/analysis/analyzers/detect_lang_analyzer" _ "github.com/couchbaselabs/bleve/analysis/analyzers/keyword_analyzer" _ "github.com/couchbaselabs/bleve/analysis/analyzers/simple_analyzer" _ "github.com/couchbaselabs/bleve/analysis/analyzers/standard_analyzer" // token filters _ "github.com/couchbaselabs/bleve/analysis/token_filters/apostrophe_filter" - _ "github.com/couchbaselabs/bleve/analysis/token_filters/cld2" _ "github.com/couchbaselabs/bleve/analysis/token_filters/edge_ngram_filter" _ "github.com/couchbaselabs/bleve/analysis/token_filters/elision_filter" _ "github.com/couchbaselabs/bleve/analysis/token_filters/keyword_marker_filter" diff --git a/config_cld2.go b/config_cld2.go new file mode 100644 index 00000000..1bf1e5d0 --- /dev/null +++ b/config_cld2.go @@ -0,0 +1,20 @@ +// Copyright (c) 2014 Couchbase, Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file +// except in compliance with the License. You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the +// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +// either express or implied. See the License for the specific language governing permissions +// and limitations under the License. + +// +build cld2 + +package bleve + +import ( + // cld2 token filter + _ "github.com/couchbaselabs/bleve/analysis/token_filters/cld2" + + // detect language analyzer + _ "github.com/couchbaselabs/bleve/analysis/analyzers/detect_lang_analyzer" +) diff --git a/examples/beer-search/main_test.go b/examples/beer-search/main_test.go index c3f52ce4..ad261141 100644 --- a/examples/beer-search/main_test.go +++ b/examples/beer-search/main_test.go @@ -1,3 +1,14 @@ +// Copyright (c) 2014 Couchbase, Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file +// except in compliance with the License. You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the +// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +// either express or implied. See the License for the specific language governing permissions +// and limitations under the License. + +// +build cld2 + package main import (