Skip to content

Commit

Permalink
add Examples
Browse files Browse the repository at this point in the history
  • Loading branch information
boliza committed Jan 10, 2018
1 parent 65329b7 commit 0b5c5db
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,57 @@ gradle mvn
# Notice

Package `com.hankcs.lucene` copy from [hanlp-lucene-plugin](https://github.com/hankcs/hanlp-lucene-plugin)

# Index and Highlight

## Mapping


`PUT test/_mapping/test`
```json
{
"properties": {
"content": {
"type": "text",
"analyzer": "hanlp-index",
"search_analyzer": "hanlp-index",
"index_options": "offsets"
}
}
}
```

## Index Document

PUT /test/test/1
```json
{
"content": ["中华人民共和国","地大物博"]
}
```

## Highlight

POST /test/test/_search
```json
{
"query": {
"match": {
"content": "中华"
}
},
"highlight": {
"pre_tags": [
"<tag1>"
],
"post_tags": [
"</tag1>"
],
"fields": {
"content": {}
}
}
}
```


0 comments on commit 0b5c5db

Please sign in to comment.