Skip to content
This repository was archived by the owner on May 25, 2021. It is now read-only.

Add custom_field_analyzers Option#34

Open
tonysun83 wants to merge 1 commit intoapache:masterfrom
cloudant:81416-custom-field-analyzers
Open

Add custom_field_analyzers Option#34
tonysun83 wants to merge 1 commit intoapache:masterfrom
cloudant:81416-custom-field-analyzers

Conversation

@tonysun83
Copy link
Contributor

This new option allows users to create separate analyzers for
fields that will be used for text indexes.

COUCHDB-3278

This new option allows users to create separate analyzers for
fields that will be used for text indexes.

COUCHDB-3278
@mayya-sharipova
Copy link

@tonysun83
This doesn't work for me as expected. Please see if I am doing something wrong:

I have created CQ search index using command:

curl -X POST -H "Content-Type: application/json" http://adm:pass@127.0.0.1:5984/movies/_index -d '{"index": {"fields":[{"name": "Movie_name", "type": "string"}], "custom_field_analyzers":[{"Movie_name" : "standard"}]}, "ddoc" : "ddoc1", "name" : "mindex", "type": "text"}'

Then, I expect that using this command:
curl -X POST -H "Content-Type: application/json" http://adm:pass@127.0.0.1:5984/movies/_find -d '{"selector": {"Movie_name": "Lethal"}, "use_index": "_design/ddoc1"}', I should find some docs, but I get no results in return:

{
  "docs": [],
  "bookmark": "g2o"
}

While running: curl -X POST -H "Content-Type: application/json" http://adm:pass@127.0.0.1:5984/movies/_find -d '{"selector": {"$text": "Lethal"}, "use_index": "_design/ddoc1"}'

I get the expected results:

{
  "docs": [
    {
      "_id": "df8cecd9809662d08eb853989a2bdab2",
      "_rev": "1-7ee437111642cabca89aa0c7ca3f7a48",
      "Movie_runtime": 118,
      "Movie_rating": "R",
      "Person_name": "Joe Pesci",
      "Actor_actor_id": "0000582",
      "Movie_genre": "ACT",
      "Movie_name": "Lethal Weapon 3",
      "Actor_movie_id": "0104714",
      "Person_pob": "Newark, New Jersey, USA",
      "Person_id": "0000582",
      "Movie_id": "0104714",
      "Movie_year": 1992,
      "Person_dob": "1943-02-09"
    },
....

I seems that even I specified "custom_field_analyzers":[{"Movie_name" : "standard"}], Movie_name field is still using keyword analyzer.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments