FriendsOfSymfony / FOSElasticaBundle

Elasticsearch PHP integration for your Symfony project using Elastica.
http://friendsofsymfony.github.io
MIT License
1.24k stars 795 forks source link

Inconsistent searches #20

Closed j closed 13 years ago

j commented 13 years ago

So I'm using this on a food database, but the searches are very inconsistent... well they seem to consistently rotate between the following two objects..

Search Query: "butter salted"

##################
# Initial search #
##################

object(Elastica_ResultSet)#106 (4) {
  ["_results":protected]=>
  array(10) {
    [0]=>
    object(Elastica_Result)#105 (1) {
      ["_hit":protected]=>
      array(5) {
        ["_index"]=>
        string(11) "website"
        ["_type"]=>
        string(4) "food"
        ["_id"]=>
        string(4) "1001"
        ["_score"]=>
        float(37.11759)
        ["_source"]=>
        array(1) {
          ["name"]=>
          string(14) "Butter, salted"
        }
      }
    }

[...]

#################
# After refresh #
#################

object(Elastica_ResultSet)#106 (4) {
  ["_results":protected]=>
  array(10) {
    [0]=>
    object(Elastica_Result)#105 (1) {
      ["_hit":protected]=>
      array(5) {
        ["_index"]=>
        string(11) "website"
        ["_type"]=>
        string(4) "food"
        ["_id"]=>
        string(5) "16132"
        ["_score"]=>
        float(9.256613)
        ["_source"]=>
        array(1) {
          ["name"]=>
          string(31) "Tofu, salted and fermented fuyu"
        }
      }
    }
[...]

"Butter, salted" should always be shown first, but it keeps rotating between the above two objects that is way wrong... anyone know why?

ornicar commented 13 years ago

does it also happen if you search from foq command line?

php app/console foq:elastica:search food "butter salted"
j commented 13 years ago

Weird, I set everything up on a new environment and it fixed itself. I'll look into why my laptop did something weird and try reinstalling elasticsearch and reindexing everything.

j commented 13 years ago

By the way, I've never used elasticsearch because it seemed like a lot of work before. This bundle is absolutely amazing so far. Great work to the devs. I can't wait till I can have more time to contribute.