Question

I am trying to implement autocomplete in my rails app. I have used both edgeNGram & analyzer to implement this & they both seem to do the same thing. Can someone please tell me why I would want to use one vs the other. Here is some sample queries

Searching the title field which is type completion

curl -X POST localhost:9200/games_201403031511/_suggest?pretty=true -d '
> {
>   "apple_game" : {
>     "text" : "mak",
>     "completion" : {
>       "field" : "title"
>     }
>   }
> }'
{
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "apple_game" : [ {
    "text" : "mak",
    "offset" : 0,
    "length" : 3,
    "options" : [ {
      "text" : "Make A Scene: Christmas",
      "score" : 1.0
    }, {
      "text" : "Make A Scene: Under The Sea",
      "score" : 1.0
    }, {
      "text" : "Make Burgers!",
      "score" : 1.0
    }, {
      "text" : "Make Cake-Cooking Games",
      "score" : 1.0
    }, {
      "text" : "Make Cake-Cooking Games HD",
      "score" : 1.0
    } ]
  } ]
}

Searching the partial field which is title with edgeNGram filter

curl -X GET "http://localhost:9200/games/_search?pretty=true" -d '{
>   "query": {
>     "query_string": {
>       "query": "partial:ma"
>     }
>   }
> }'
{
  "took" : 3,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 3864,
    "max_score" : 3.3052132,
    "hits" : [ {
      "_index" : "games_201403031511",
      "_type" : "apple_game",
      "_id" : "16474",
      "_score" : 3.3052132, "_source" : {"title":"MapQuiz","description":"John Wiley & Sons, Inc. brings you MapQuiz.\n\nHow well do you know your world? With 12 regional quizzes, MapQuiz tests your geographic knowledge. How many countries can you identify and how fast can you name them?  How about the states of the U.S.?\n\nThis geography quiz app is a fun and quick way to learn the names of all the countries of the world.  Also, you can learn the names of all U.S. states and provinces of Canada.\n\nThis app features:\n\n* An intuitive game-like interface\n* Scoreboards\n* A useful \u2018hint feature\u2019\n\n<b>Learn geography with MapQuiz!</b>","developer":"Exprima Media","category":"[Games, Education, Educational, Trivia]"}
    }, {
      "_index" : "games_201403031511",
      "_type" : "apple_game",
      "_id" : "24989",
      "_score" : 3.3052132, "_source" : {"title":"Mathtastical","description":"Did you ever play a math game which was fun? We neither! So we decided to make one \u2026! \nPlay & learn at the same time \u2013 you are even allowed to cheat!\n\nCollect gems by solving the calculations, buy power-ups and use them to climb up the leaderboards.\nSome pretty hard achievements are also there for you to be beaten.\n\nMathtastical is fully built with Apples all new SpriteKit, which is especially made for performant and beautiful 2D games.\n\nTell your friends about Mathtastical and share the fun! Rumor says, that there could be an absolutely free update with iPad-support in the making \u2026","developer":"Daniel Griesser","category":"[Games, Entertainment, Arcade, Educational]"}
    }, {
      "_index" : "games_201403031511",
      "_type" : "apple_game",
      "_id" : "30075",
      "_score" : 3.3052132, "_source" : {"title":"Math4Fun+","description":"Have fun and become better at math at the same time, with Math4Fun+ for iPad. \n\nMath4Fun+ is a fun and educational single player game that can be played by both older kids and adults. Math4Fun+ contains calculations such as additions, subtractions, multiplications and divisions in different difficulty levels. \n\nIt's easy to get started... simply press play and start answering the questions. To pass a level you need to answer at least 50% questions correct before the time runs out.\n\nMath4Fun+ is using Game Center to record your high score and achievements to make it easy and fun to compete against other players.","developer":"eSolutions","category":"[Games, Board, Educational]"}
    }, {
      "_index" : "games_201403031511",
      "_type" : "apple_game",
      "_id" : "27503",
      "_score" : 3.3052132, "_source" : {"title":"MagicTowerTheBraveTried","description":"The classic MagicTower(TSW) comes back.Do you remember MagicTower of 50 floors in young ages. Now it is time to meet it again. A bundle of difficulties in the game are waiting for you.","developer":"Jijie Qiu","category":"[Games, Role Playing, Strategy]"}
    }, {
      "_index" : "games_201403031511",
      "_type" : "apple_game",
      "_id" : "36701",
      "_score" : 3.3052132, "_source" : {"title":"MadMatch","description":"Are you bored with classical memory games? Try MadMatch, a memory game of a new kind. Turn the cards over and match the pairs. Nothing new so far... but mismatch a pair and Madmatch will drive you mad since a mismatched pair will result in a new difficulty: cards change location.\n\nMore than a memory game MadMatch is a real brain teaser.\n\nTwo difficulty levels are available. In \u201cregular\u201d mode, the two played cards switch location; in \u201cdifficult\u2019 mode a total of four cards move about. Beware of headaches!\n\nShaking, Hypno and MadMatch levels: these levels offer various card backs to help you \u2013 or not \u2013 remembering the card movements. In ShakingMatch mode the back of each card displays a distinctive animal face. In HypnoMatch mode your memory is challenged and confusion reigns as the card backs display vegetal and geometrical patterns less easy to tell apart. Finally, if you are brave enough, give the MadMatch level a try. You will have to rely solely on your memory since all the cards look the same and you are not helped. Good luck!\n\nZenMatch level : your brain no longer sustains the pace of the game? Go to Zen level, a classical memory game which will suit all.\n\nFasten your neurones, bumpy weather ahead with MadMatch!\n\nCharacteristics:\n\u2013 1 game mode to relax your brain\n\u2013 3 lively game modes with a choice between two levels of difficulty\n\u2013 An elegant and well designed interface\n\u2013 The five best times for each level are saved\n\u2013 Optional sound effects activation and option to reset best times\n- GameCenter and Facebook support\n\u2013 Languages: English, French and Spanish\n\u2013 Migraine pills not supplied","developer":"Pascal Pineau","category":"[Games, Entertainment, Card, Puzzle]"}
    }, {
      "_index" : "games_201403031511",
      "_type" : "apple_game",
      "_id" : "35532",
      "_score" : 3.3052132, "_source" : {"title":"Mahjong136","description":"This is the easy Mahjong game. No flower tile and complicated scoring of points. Just focus on winning other players within the limited time. You will see all tiles if any player's score is smaller than 300.","developer":"Chih Chiang Wang","category":"[Games, Board, Card]"}
    }, {
      "_index" : "games_201403031511",
      "_type" : "apple_game",
      "_id" : "4932",
      "_score" : 3.2593935, "_source" : {"title":"Mancala.","description":"Mancala (also known as Kalah) is an ancient board game. Pick up marbles from any of bottom holes and move them counter-clockwise. If your move ends at your home hole (right one) you can move again. The game ends when all six holes on either side are empty. The winner is the player with the most marbles in home hole.","developer":"Byterun","category":"[Games, Entertainment, Board, Strategy]"}
    }, {
      "_index" : "games_201403031511",
      "_type" : "apple_game",
      "_id" : "4343",
      "_score" : 3.2593935, "_source" : {"title":"MahJong+","description":"MahJong Solitaire is a matching game for one player. The goal of the game is to remove all tiles out of the board by pairs.\nSelect tiles with the same picture and they will disapear. Only free tiles that are not covered are allowed to remove.\n\nThe game contains 200 different layouts, including the classic \"Turtle\". At any moment you can use Undo, Hint and Shuffle.\n\nGame features:\n\n- 200 board layouts\n- Customizable background pictures\n- 8 realistic tilesets\n- Undo, hint and shuffle option\n- HD graphics for iPad\n- Optional dimming of blocked tiles\n- Easy small and hard big layouts\n- Game with no time limits\n- Every layout is winnable\n- Auto-save when you exit","developer":"Byterun","category":"[Games, Entertainment, Board, Family]"}
    }, {
      "_index" : "games_201403031511",
      "_type" : "apple_game",
      "_id" : "6717",
      "_score" : 3.2593935, "_source" : {"title":"Majong","description":"Very popular solitaire matching game, the perfect choice for the everyone looking for relaxing and meditative replay.\n\nEnjoy stunning HD graphics at any device you have: it is universal application. Complete different layouts with unique tiles arrangement, automatic zoom will help to manage tiles easily. Lovely music, natural sounds, various backgrounds makes this game a must have puzzle.","developer":"DoraLogic","category":"[Games, Card, Entertainment, Puzzle]"}
    }, {
      "_index" : "games_201403031511",
      "_type" : "apple_game",
      "_id" : "11512",
      "_score" : 3.2593935, "_source" : {"title":"Math \u00ae","description":"REACTION TIME GAME: How fast are you? How smart are you? Math Racer knows the answer! Compete for the fastest times against friends and family, stamp your initials on the high-score board for all to see. Seven games with four levels each for 28 separate high-score boards! \n\nMath Racer is by far the fastest Math Speed Testing App on the App Store. Our simple interface removes all possible barriers between your brain and your reaction time. All times are measured to the hundredth of a second for even more fun.\n\nWhat users are saying about Math \u00ae:\n\n\u2605 \"An app game I actually use\" - Kuto\n\u2605 \"This is an excellent tool I use in my classroom\" - Ktoens\n\u2605 \"This is a really great concept\" - MM38866\n\u2605 \"I love this app\" - Asweetswweta\n\nEach user can enter their own initials like in the arcades to keep track of high-scores and game details like exactly how long each problem took and which problems were missed. All user misses are tracked and organized to highlight areas for improvement.\n\nWhether you are 99, 3+1 or 36/2 years old, there is a game and a level that will challenge your skills and push you to become faster than you ever thought you could be.\n\nMath Racer... Race against TIME!\n\n\n**************************\nSpecial Note from the Architect: \n\nI wanted to push the limits of human ability and find out how quickly people can answer 10 or 100 basic math problems if all barriers to that task are removed. Entering 91 on a number pad and pressing enter can take 2 seconds for many people. Writing the number 55 in pencil can take as long as 4 seconds for slower writers because of the strokes involved. Listening to a verbal question and verbalizing the answer 27 can take as long 4 seconds as well because of the four syllables.\n\nWhen you add up these 2 to 4 second User-Interface delays over 100 problems, they can add 200 to 400 seconds to the total time required. It becomes quickly apparent that Math Tests do not test math calculation, memory or thinking abilities as much as they test handwriting, verbalization or keypad entry skills. We have shown that it is possible for a really fast thinker to answer 1 math problem every .9 seconds using Math Racer.  In fact, Math \u00ae is the only app in the app store that measures and records for viewing on the high score board detail view exactly how long it took the user to answer each question in hundredths of a second.\n\nThe purpose of this game is to even the playing field and test pure math calculation or memory skills alone. Nothing else ever invented for testing math speed even comes close. We think you'll agree. Please let us know your thoughts. We welcome any and all feedback that will help us make Math Racer even faster. \n\nThe world record in answering 100 Random Math Problems will likely be set on an iPhone 4 using Math \u00ae in the next 12 months... Maybe YOU will set it!\n\nThank You. \n\n-Michael\n\n**************************","developer":"i4software","category":"[Games, Education, Educational]"}
    } ]
  }
}

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top