La classificazione delle professioni utilizza Elasticsearch. I livelli della classificazione sono disponibili attraverso dei servizi REST.
Indice CP
--:::::::::: CREAZIONE DELL'INDICE ::::::::::::--
PUT /professioni
{
"settings": {
"analysis": {
"filter": {
"italian_stop": {
"type": "stop",
"stopwords": "_italian_"
},
"italian_stemmer": {
"type": "stemmer",
"language": "italian"
}
},
"analyzer": {
"italian": {
"tokenizer": "standard",
"filter": [
"lowercase",
"italian_stop",
"italian_stemmer"
]
},
"lower": {
"tokenizer": "standard",
"filter": [
"lowercase"
]
}
}
}
},
"mappings": {
"cp2011": {
"properties": {
"nome": {
"type": "string",
"analyzer": "italian"
},
"descrizione": {
"type": "string",
"analyzer": "italian"
},
"nome_not_analyzed": {
"type": "string",
"analyzer": "lower"
},
"pk_livello": {
"type": "string",
"analyzer": "not_analyzed"
}
}
}
}
}
{
"from" : 0,
"size" : 8300,
"query": {
"match_all": {}
}
}
{
"from" : 0,
"size" : 200,
"query": {
"match_phrase": {
"notAnalyzed" : {
"query" : "elettrauto"
}
}
},
"highlight": {
"fields" : {
"notAnalized" : {}
}
}
}
{
"from" : 0,
"size" : 8300,
"query": {
"filtered": {
"filter": {
"regexp": {
"pkLivello": {
"value": ".{1,1}"
}
}
}
}
}
}
{
"nome" : {
"text" : "pasticcioo",
"term" : {
"field" : "nome"
}
}
}
{
"from" : 0,
"size" : 8300,
"query": {
"match_phrase": {
"pkLivello" : {
"query" : "3.1.1.1"
}
}
},
"highlight": {
"fields" : {
"nome" : {}
}
}
}
Il motore di ricerca può essere incluso all'interno di altre applicazioni, copiano lo script seguente.