mstein / elasticsearch-grails-plugin

ElasticSearch grails plugin
Based on Graeme Rocher initial stub. Note that it is still in early stage.
Other
62 stars 164 forks source link

results.total does not correspond to results.searchResults.size() (in some cases) #68

Open littleiffel opened 11 years ago

littleiffel commented 11 years ago

I see sometimes in the logs "Unknown SearchHit...."

And in this case the total does not correspond (but is higher then) the size of returned hits.

I see that some hits are not added to resultsList in buildResults(). Why is this happening? Is this behaviour desired or is it a bug?

mstein commented 11 years ago

The plugin does not include results if it doesn't have a mapping for it, it may also mean that he fails to recognize the result as a valid domain. Could you provide an example of the domain & request where this issue occurs ?

littleiffel commented 11 years ago

I have 3 domain classes. One common Parent

class Item{
  static searchable = {
      root = false
   }
  String descritption
  String title
}
class Offer extends Item{
   static searchable = {
      only = ['title', 'description']
   }
}
class Request extends Item{
   static searchable = {
      only = ['title', 'description']
   }
}

When i use elasticSearchSerivce.search('query') it finds one Offer. (That is correct. It should find 1 Offer) But the result is as follows:

['total':2, 'searchResults':[Offer: 1234]]

Offer.search('query') does not return anything and Item.search('query') does not exisit (as expected).

I assume it is the inheritance that might cause some problems?