added build tag to enable cld2
This commit is contained in:
parent
4d8fc94d0e
commit
f37bb77794
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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 (
|
||||
|
@ -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"
|
||||
|
20
config_cld2.go
Normal file
20
config_cld2.go
Normal 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"
|
||||
)
|
@ -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 (
|
||||
|
Loading…
Reference in New Issue
Block a user