magwyz / pastec

Image recognition open source index and search engine
http://pastec.io
GNU Lesser General Public License v3.0
620 stars 175 forks source link

Return search results with score #9

Closed chrishein closed 9 years ago

chrishein commented 9 years ago

I think it can be useful to return each search result with the score, as this may enable clients searching for images to determine which results are good enough for their specific use of Pastec.

Example response:

{
   "bounding_rects" : [
      {
         "height" : 381,
         "width" : 394,
         "x" : 73,
         "y" : 31
      }
   ],
   "image_ids" : [
      {
         "id" : 19,
         "score" : 1201.0
      }
   ],
   "type" : "SEARCH_RESULTS"
}
magwyz commented 9 years ago

Thank you for your contribution.

Returning each match score is something that could indeed be useful for some users. However, for backward compatibility, it would be better, as a first step, to put it in a new "scores" array rather than in the "image_ids" array. For a next version of Pastec, when it will be possible to break the API, the id, the score and the bounding_rect will be returned in an object of a common "matches" array.

chrishein commented 9 years ago

Sounds good. I updated the pull request to return scores in separate array.

magwyz commented 9 years ago

Thanks!