0
0

added build tag to enable cld2

This commit is contained in:
Marty Schoch 2014-08-25 11:24:20 -04:00
parent 4d8fc94d0e
commit f37bb77794
6 changed files with 44 additions and 4 deletions

View File

@ -6,18 +6,23 @@
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, // 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 // either express or implied. See the License for the specific language governing permissions
// and limitations under the License. // and limitations under the License.
// +build cld2
package detect_lang_analyzer package detect_lang_analyzer
import ( import (
"github.com/couchbaselabs/bleve/analysis" "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/token_filters/lower_case_filter"
"github.com/couchbaselabs/bleve/analysis/tokenizers/single_token"
"github.com/couchbaselabs/bleve/registry" "github.com/couchbaselabs/bleve/registry"
) )
const Name = "detect_lang" const Name = "detect_lang"
func AnalyzerConstructor(config map[string]interface{}, cache *registry.Cache) (*analysis.Analyzer, error) { 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 { if err != nil {
return nil, err return nil, err
} }
@ -25,7 +30,7 @@ func AnalyzerConstructor(config map[string]interface{}, cache *registry.Cache) (
if err != nil { if err != nil {
return nil, err return nil, err
} }
detectLangFilter, err := cache.TokenFilterNamed("detect_lang") detectLangFilter, err := cache.TokenFilterNamed(cld2.Name)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -6,6 +6,9 @@
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, // 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 // either express or implied. See the License for the specific language governing permissions
// and limitations under the License. // and limitations under the License.
// +build cld2
package cld2 package cld2
// #cgo LDFLAGS: -lcld2_full // #cgo LDFLAGS: -lcld2_full

View File

@ -6,6 +6,9 @@
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, // 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 // either express or implied. See the License for the specific language governing permissions
// and limitations under the License. // and limitations under the License.
// +build cld2
package cld2 package cld2
import ( import (

View File

@ -20,14 +20,12 @@ import (
_ "github.com/couchbaselabs/bleve/analysis/char_filters/zero_width_non_joiner" _ "github.com/couchbaselabs/bleve/analysis/char_filters/zero_width_non_joiner"
// analyzers // analyzers
_ "github.com/couchbaselabs/bleve/analysis/analyzers/detect_lang_analyzer"
_ "github.com/couchbaselabs/bleve/analysis/analyzers/keyword_analyzer" _ "github.com/couchbaselabs/bleve/analysis/analyzers/keyword_analyzer"
_ "github.com/couchbaselabs/bleve/analysis/analyzers/simple_analyzer" _ "github.com/couchbaselabs/bleve/analysis/analyzers/simple_analyzer"
_ "github.com/couchbaselabs/bleve/analysis/analyzers/standard_analyzer" _ "github.com/couchbaselabs/bleve/analysis/analyzers/standard_analyzer"
// token filters // token filters
_ "github.com/couchbaselabs/bleve/analysis/token_filters/apostrophe_filter" _ "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/edge_ngram_filter"
_ "github.com/couchbaselabs/bleve/analysis/token_filters/elision_filter" _ "github.com/couchbaselabs/bleve/analysis/token_filters/elision_filter"
_ "github.com/couchbaselabs/bleve/analysis/token_filters/keyword_marker_filter" _ "github.com/couchbaselabs/bleve/analysis/token_filters/keyword_marker_filter"

20
config_cld2.go Normal file
View File

@ -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"
)

View File

@ -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 package main
import ( import (