Manage Elasticsearch uye Solr analyzer gadziriso mafaera

Share on facebook
Share on twitter
Share on linkedin
Goverana pane pinterest
Goverana pane reddit
Goverana pamusoro tumblr

Zviri Mukati

Zvimwe zvekutsvaga injini Ongororo Huya ne “nzira yefaira"Paramende, panzvimbo pakareba kukosha paramende (bool, tambo, rondedzero, ...). Asi sei uye kupi kwekuisa iyo paramende faira kazhinji inowanzova yepuzzle. Kunyanya kana, seni, mumwe anoshandisa akati wandei kutsvaga injini.

Saka, ndafunga kunyora diki "maitiro" aSolr uye Elasticsearch. Kesi yega yega yekushandisa inonyorwa neiyo cURL kana iyo shell yekuraira inodikanwa kudzokorora dzidzo pane yako nharaunda. Nzvimbo yekudzidziswa ndeyeVagrant Linux Ubuntu 16.04.6 LTS, ne Solr 8.1.1 uye Elasticsearch 7.3.

Iyo fundo ichave yakavakirwa pane inowanzo shandiswa Chiratidzo faira, iyo Fanananidzo.

Ngatisanganei kutanga kune yekutsvaga injini server ne ssh (pano, iyo vagrant muchina paMacOS):

Mufananidzo izwi-mufananidzo.png yeManage Elasticsearch uye Solr analyzer gadziriso mafaera

Elasticsearch

Isu tichashandisa Elasticsearch Synonym Chiratidzo Chekuita nedzidziso yedu.

Zvinoshamisa kuti Elasticsearch haisati yapa REST API yekumisa faira redu rekushandisa. Semhedzisiro, isu tinofanirwa kushandisa mirairo yegorosi.

Kutanga, tsvaga yedu Elasticsearch gadziriso dhairekitori. Unogona kuwana ruzivo rwakanaka mukati https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html

asi iyo nzira iri nyore yekuziva iyo Elasticsearch gadziriro yedhairekita ndeyekugadzira index isina iyo faira rakaiswa izvozvi. Elasticsearch ine mutsa zvakakwana kuratidza iyo yakarasika faira uye dhairekita dhairekesheni mukukanganisa meseji:

curl -X PUT "localhost: 9200 / test_index? tsvar" -H 'Zvemhando-Type: application / json' -d '

{

"Marongero": {

"Index": {

"Kuongorora": {

"Analyzer": {

"Zvakafanana": {

"Tenderizer": "chena",

"Filter": ["zvakafanana"]

}

},

"Filter": {

"Zvakafanana": {

"Type": "zvakafanana",

"Synonyms_path": "ukuhlaziywa / mutemat.txt"

}

}

}

}

}

} '

Mufananidzo izwi-mufananidzo-1.png yeManage Elasticsearch uye Solr analyzer gadziriso mafaera

Zvino, gadza (apa, gadzira) iyo faidhi yekusimbisa:

vagrant @ vvv: ~ $ sudo mkdir / etc / elasticsearch / kuongororwa

vagrant @ vvv: ~ $ sudo vi /etc/elasticsearch/analysis/synonym.txt
(kopira zvirevo zvako mufaira, wobva wasunga)

vagrant @ vvv: ~ $ sudo kati /etc/elasticsearch/analysis/synonym.txt
# Risina mitsara uye mitsara inotanga ne pound ndeemashoko.

# Mappings akajeka anoenderana nechero kuteedzana kwechiratidzo paLHS ye "=>"

# uye kutsiva nedzimwe nzira dzose pane RHS. Aya marudzi emapepa

# tendera kusarudzika paramende rekuwedzera mune schema.

# Mienzaniso:

i-pod, ini pod => ipod,

biscuit yegungwa, biscit yegungwa => seabiscuit

# Zvakafanana zvirevo zvinogona kuparadzaniswa nekomichi uye zvipe

# hapana mepu yakajeka. Mune ino kesi maitiro ekugadzira mepu achaita

# inotorwa kubva parutivi rwakawedzera mu schema. Izvi zvinobvumira

# iyocheteyo faira refaira rinoshandiswa muzvirongwa zvakabatana zvekubata.

# Mienzaniso:

ipod, i-pod, ini pod

foozball, foosball

zvakasikwa, cosmos

lol, kuseka kwazvo

# Kana kuwedzera = = ichokwadi, "ipod, i-pod, i pod" yakaenzana

# kune iyo yakajeka mepu:

ipod, i-pod, ini pod => ipod, i-pod, ini pod

# Kana wedzera == nhema, "ipod, i-pod, i pod" yakaenzana

# kune iyo yakajeka mepu:

ipod, i-pod, ini pod => ipod

# Multiple mutsara akafanana wemepu mamakisi akabatanidzwa.

foo => foo bhaa

foo => baz

# yakaenzana

foo => foo bar, baz

Mufananidzo izwi-mufananidzo-2.png yeManage Elasticsearch uye Solr analyzer gadziriso mafaera

Zvino, gadzira rondedzero neiyo Synonyms tokeni firita, yakarongedzwa neiyo yakaiswa faira yekufananidza:

Mufananidzo izwi-mufananidzo-3.png yeManage Elasticsearch uye Solr analyzer gadziriso mafaera

Iye zvino, tinogona kuona kuti reinternet.txt faira iri kushanda sezvanga zvichitarisirwa:

Mufananidzo izwi-mufananidzo-4.png yeManage Elasticsearch uye Solr analyzer gadziriso mafaera

Izvi zvaitwa. Takagadzira indekisi nyowani, ine faira rekushandisa rakaiswa muElasticsearch conf dhairekitori.

 

Solr

Isu tichashandisa Solr Synonyms Girafu Sefa

Basa redu rekutanga kugadzira nyowani nyowani, pasina ma conf mafaira, kuti uwane iyo dhairekitori kubva ku Solr kukanganisa meseji:

Mufananidzo izwi-mufananidzo-5.png yeManage Elasticsearch uye Solr analyzer gadziriso mafaera

Mufananidzo izwi-mufananidzo-6.png yeManage Elasticsearch uye Solr analyzer gadziriso mafaera

Ngatiwedzerei iyi inotevera shambaType kune yedu schema.xml, ine Synonym firimu:


Neruzivo rweSolr conf folders edu, tinogona pakupedzisira kuisa iyo index mafaera:

cd /solr-8.1.1/server/solr

mkdir -p new_index / conf

(isa solrconfig.xml, schema.xml, uye musanganiswa.xml: haina kurondedzerwa pano)

Mufananidzo izwi-mufananidzo-7.png yeManage Elasticsearch uye Solr analyzer gadziriso mafaera

Zvakanaka. Isu tagadzirira kugadzira iyo index itsva:

Mufananidzo izwi-mufananidzo-8.png yeManage Elasticsearch uye Solr analyzer gadziriso mafaera

Mufananidzo izwi-mufananidzo-9.png yeManage Elasticsearch uye Solr analyzer gadziriso mafaera

Ikozvino, simbisa kuti inoenderana.txt iri munzvimbo uye mupenyu, nekuda kweiyo analyzer peji:

Mufananidzo izwi-mufananidzo-10.png yeManage Elasticsearch uye Solr analyzer gadziriso mafaera

Izvi zvaitwa. Takagadzira indekisi nyowani, ine faira rekushandisa rakaiswa muSol conf conf dhairekitori.

 

 

en English
X