0

I'm just implementing elasticsearch on my database of foods, and I'm having difficulty understanding why I'm seeing the results I'm seeing.

I'm searching the USDA food database.

When I pass in the query for Banana, I get back all forms of singular for Banana, and one entry Bananas, dehydrated, or banana powder.

When I pass the query Bananas, I get the above mentioned entry, as well as Bananas, Raw, which is the entry I am trying to get.

I search really simply using

   foods = Foods.search(params[:name],:page_size=>100)
   return render :json => foods

I've tried looking at both the tire and elasticsearch documentation, but don't really understand what it is trying to tell me about implementing kstem or other ways of tuning the search, and I also would think if one type of 'bananas', gets returned, the other type should as well.

pedalpete
  • 21,076
  • 45
  • 128
  • 239

1 Answers1

0

Unless I'm missing something when you search for "banana" you get "Bananas, dehydrated, or banana powder" because "banana" is matched twice in that entry.

When you search for "bananas" you get that entry because it matches on "bananas" part which also explains why you get "Bananas, Raw".

concept47
  • 30,257
  • 12
  • 52
  • 74