0
0

switch fr to not require icu/libstemmer

also corrected copy/paste bug in test
This commit is contained in:
Marty Schoch 2015-03-11 11:46:33 -04:00
parent 8ae30fb6f0
commit eeaf514848
2 changed files with 4 additions and 10 deletions

View File

@ -7,9 +7,6 @@
// 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 libstemmer full
// +build icu full
package fr package fr
import ( import (
@ -17,13 +14,13 @@ import (
"github.com/blevesearch/bleve/registry" "github.com/blevesearch/bleve/registry"
"github.com/blevesearch/bleve/analysis/token_filters/lower_case_filter" "github.com/blevesearch/bleve/analysis/token_filters/lower_case_filter"
"github.com/blevesearch/bleve/analysis/tokenizers/icu" "github.com/blevesearch/bleve/analysis/tokenizers/unicode"
) )
const AnalyzerName = "fr" const AnalyzerName = "fr"
func AnalyzerConstructor(config map[string]interface{}, cache *registry.Cache) (*analysis.Analyzer, error) { func AnalyzerConstructor(config map[string]interface{}, cache *registry.Cache) (*analysis.Analyzer, error) {
icuTokenizer, err := cache.TokenizerNamed(icu.Name) tokenizer, err := cache.TokenizerNamed(unicode.Name)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -44,7 +41,7 @@ func AnalyzerConstructor(config map[string]interface{}, cache *registry.Cache) (
return nil, err return nil, err
} }
rv := analysis.Analyzer{ rv := analysis.Analyzer{
Tokenizer: icuTokenizer, Tokenizer: tokenizer,
TokenFilters: []analysis.TokenFilter{ TokenFilters: []analysis.TokenFilter{
elisionFilter, elisionFilter,
toLowerFilter, toLowerFilter,

View File

@ -7,9 +7,6 @@
// 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 libstemmer full
// +build icu full
package fr package fr
import ( import (
@ -171,7 +168,7 @@ func TestFrenchAnalyzer(t *testing.T) {
Term: []byte("ïaöuaä"), Term: []byte("ïaöuaä"),
}, },
&analysis.Token{ &analysis.Token{
Term: []byte("anticonstitutionel'hui"), Term: []byte("anticonstitutionel"),
}, },
&analysis.Token{ &analysis.Token{
Term: []byte("java"), Term: []byte("java"),