Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

There are no search results

I use phalcon/forum to create a local project, locally installed elasticsearch1.7.5. I have run scripts/search-tasks.php, I use mysql, I can not search anything,why? thanks in advanced.

1: check apache log, no error -> 2:check php log, no error -> 3: check mysql log.. you will isolate where the error happen and it will be easier to help you

I don't know. Probably there is some problem.



1.2k
edited Jun '16
  • As your guide,I checked all the logs, they have no errors.
  • Using commands in elasticsearch, I can get right results like this
  • curl -XGET 'http://localhost:9200/phosphorum/post/%5search?q=11
  • But in my project,I can't
  • code tracing
  • E:\wamp64\www\forum\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Transport.php
  • ```php <?php try { if (isset($body) === true) { $body = $this->serializer->serialize($body); } var_dump($connection->performRequest());exit; $response = $connection->performRequest( $method, $uri, $params, $body );

        $connection->markAlive();
        $this->retryAttempts = 0;
    
    
    
    $data = $this->serializer->deserialize($response['text'], $response['info']);
    return array(
        'status' => $response['status'],
        'data'   => $data,
        'info'   => $response['info'],
    );
    
    }

    ```

  • $method = 'GET' $uri = '/phosphorum/post/_search' $params = array()
  • $body = "fields":["id","karma"],"query":{"bool":{"must":[{"term":{"title":"11"}},{"term":{"content":"11"}}]}},"from":0,"size":50}
  • Why $data is empty?
  • Forgive my broken english , thanks in advanced!

1: check apache log, no error -> 2:check php log, no error -> 3: check mysql log.. you will isolate where the error happen and it will be easier to help you



7.6k
Accepted
answer

if apache log doesn't return 404 and the script run well from the cli, I think you have to look how you add elasticsearch class to your phalcon project, do you use universal class loader , composer, include in index.php? are you using namespace in your project?, does php log return such a 'class not found' type error?



1.2k

Thank you very much!

I don't know. Probably there is some problem.



1.2k

Thank you for your serious answer! I check my codes, and in Indexer.php, losing title and content . I insert them into fields array, it's OK! Thank u very much!