Custom stemmer with elasticsearch / tire / rails


(oto iashvili) #1

Hi,

Im' searchinkg to ass new stemmer to elastisearch to use with tire / rails

I've found java file
(https://github.com/emilis/PolicyFeed/blob/master/src/search/java/org/tartarus/snowball/ext/LithuanianStemmer.java)
I've created a jar from this file
I've put it in elasticsearch's lib folder

here my rails file

tire.settings :analysis => {
:filter => {
"lt_stemmer" => {
"type" => "stemmer",
"name" => "lithuanian",
"rules_path" => "lt_stemmer.jar"
}
},
:analyzer => {
"lithuanian" => {
"type" => "snowball",
"tokenizer" => "keyword",
"filter" => ["lowercase", "lt_stemmer"]
},
},
} do
mapping do
indexes :titre_lt, :analyzer => "lithuanian"

end

I succeed them to create index and index data, but when I test, it seems it
doesn't use the rule in my jar file.

curl -XGET 'localhost:9200/lituanieindex/_analyze?analyzer=lithuanian' -d
'smulkių, dalinių, pilnų krovinių pervežimas nuosavais arba partnerių
vilkikais su standartinėmis 92 m3 puspriekabėmis ir 120 m3 autotraukiniais;'

{"tokens":[{"token":"smulkių","start_offset":0,"end_offset":7,"type":"","position":1},{"token":"dalinių","start_offset":9,"end_offset":16,"type":"","position":2},{"token":"pilnų","start_offset":18,"end_offset":23,"type":"","position":3},{"token":"krovinių","start_offset":24,"end_offset":32,"type":"","position":4},{"token":"pervežima","start_offset":33,"end_offset":43,"type":"","position":5},{"token":"nuosavai","start_offset":44,"end_offset":53,"type":"","position":6},{"token":"arba","start_offset":54,"end_offset":58,"type":"","position":7},{"token":"partnerių","start_offset":59,"end_offset":68,"type":"","position":8},{"token":"vilkikai","start_offset":69,"end_offset":78,"type":"","position":9},{"token":"su","start_offset":79,"end_offset":81,"type":"","position":10},{"token":"standartinėmi","start_offset":82,"end_offset":96,"type":"","position":11},{"token":"92","start_offset":97,"end_offset":99,"type":"","position":12},{"token":"m3","start_offset":100,"end_offset":102,"type":"","position":13},{"token":"puspriekabėmi","start_offset":103,"end_offset":117,"type":"","position":14},{"token":"ir","start_offset":118,"end_offset":120,"type":"","position":15},{"token":"120","start_offset":121,"end_offset":124,"type":"","position":16},{"token":"m3","start_offset":125,"end_offset":127,"type":"","position":17},{"token":"autotraukiniai","start_offset":128,"end_offset":143,"type":"","position":18}]}

what do I do wrong ?

thanks for help

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/c4bd01c5-832a-42b4-8218-8263ca284f25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2