1

我使用串行拿到領域,併爲波蘭語搜索elasticSearch斯坦普爾插件工作。想要得到的東西就像這個例子,但沒有成功:Asciifolding不FOSElasticabundle

https://www.elastic.co/guide/en/elasticsearch/guide/current/asciifolding-token-filter.html#asciifolding-token-filter

這是我的配置:

fos_elastica: 
    serializer: ~ 
    clients: 
     default: { host: 127.0.0.1, port: 9200 } 
    indexes: 
     bpo: 
      settings: 
       index: 
        analysis: 
         analyzer: 
          folding: 
           tokenizer: standard 
           filter: [standard, lowercase, asciifolding, polish_stem] 
     types: 
      company: 
       properties: 
        name: 
         type: string 
         analyzer: standard 
         fields: 
          folded: 
           type: string 
           analyzer: folding 
       serializer: 
        groups: [elastica] 
        version: '1.1' 
        serialize_null: true 
       persistence: 
        driver: orm 
        model: AppBundle\Entity\Company 
        repository: AppBundle\Repository\CompanyRepository 
        provider: ~ 
        finder: ~ 

再檢查:

$ curl "127.0.0.1:9200/bpo/_analyze?analyzer=folding&text=spółka&pretty" 
{ 
    "tokens" : [ { 
    "token" : "spᅢ뺴", 
    "start_offset" : 0, 
    "end_offset" : 5, 
    "type" : "<ALPHANUM>", 
    "position" : 0 
    }, { 
    "token" : "ツ", 
    "start_offset" : 5, 
    "end_offset" : 6, 
    "type" : "<KATAKANA>", 
    "position" : 1 
    }, { 
    "token" : "ka", 
    "start_offset" : 6, 
    "end_offset" : 8, 
    "type" : "<ALPHANUM>", 
    "position" : 2 
    } ] 
} 

試圖讓ß ⇒ ss即使

$ curl "127.0.0.1:9200/bpo/_analyze?analyzer=folding&text=ß&pretty" 
{ 
    "tokens" : [ { 
    "token" : "ᅢ゚", 
    "start_offset" : 0, 
    "end_offset" : 2, 
    "type" : "<HANGUL>", 
    "position" : 0 
    } ] 
} 

當我試圖從瀏覽器得到一些迴應 - 「spółka」得到我正確的數據,但「spolka」沒有返回。

我需要過濾器,或者什麼?

+0

如何看待你的映射? – rad11

+0

@ rad11 [馬平要點](https://gist.github.com/anonymous/2b0e9c0d04b69d50db820fa39952ea0f)我使用PostgreSQL的 –

+0

- 如果有人可以幫助我。 –

回答

1

我解決了這個問題,從「折」到「默認」買入改變分析器的名字。 這個工作適合我。

工作配置:

fos_elastica: 
    serializer: ~ 
    clients: 
     default: { host: 127.0.0.1, port: 9200 } 
    indexes: 
     bpo: 
      settings: 
       index: 
        analysis: 
         analyzer: 
          default: 
           tokenizer: standard 
           filter: [standard, lowercase, asciifolding, polish_stem] 
相關問題