ElasticSearch is not returning results for keywords

Please report bugs here!

Moderator: Thorsten

Post Reply
v3gard
Posts: 3
Joined: Mon Jan 21, 2019 11:06 am

ElasticSearch is not returning results for keywords

Post by v3gard » Mon Jan 21, 2019 11:17 am

I'm currently on phpMyFAQ 2.9.11, and have it connected to ElasticSearch 2.4.6. Searching appears to be working on the HTML area of the FAQ, but the keywords seem to be ignored.

I did a test with a new post where the HTML content did not contain the keyword I was searching for. Instead it was included in the keywords area (comma separated) along with other values. When I did a search for the keyword, the FAQ was not found. Then, I copied the keywords into a <div "hidden"></div> area in the HTML, and the FAQ was found.

I assume there must be a configuration error somewhere, unless Elastic Search ignores the keywords. Any ideas`?

Here is output from my Elastic Search server.

Code: Select all

root@faq:~# curl "localhost:9200/"                                              {
  "name" : "prod-faq-1",
  "cluster_name" : "faq",
  "cluster_uuid" : "g8EabpdxShy_YRD-kBb6zw",
  "version" : {
    "number" : "2.4.6",
    "build_hash" : "5376dca9f70f3abef96a77f4bb22720ace8240fd",
    "build_timestamp" : "2017-07-18T12:17:44Z",
    "build_snapshot" : false,
    "lucene_version" : "5.5.4"
  },
  "tagline" : "You Know, for Search"
}
My config/elasticsearch.php file looks like this:

Code: Select all

<?php
$PMF_ES['hosts'] = ['127.0.0.1:9200'];
$PMF_ES['index'] = 'phpmyfaq';
$PMF_ES['type'] = 'faqs';
?>

v3gard
Posts: 3
Joined: Mon Jan 21, 2019 11:06 am

Re: ElasticSearch is not returning results for keywords

Post by v3gard » Mon Jan 21, 2019 11:34 am

Sorry. Looks like this was a PEBKAC related problem. I wasn't able to reproduce the error.

Should anyone else encounter similar issues, ElasticSearch can be accessed directly using CURL.

Code: Select all

e.g. curl "http://localhost:9200/phpmyfaq/faqs/1012?pretty"

{
  "_index" : "phpmyfaq",
  "_type" : "faqs",
  "_id" : "1012",
  "_version" : 7,
  "found" : true,
  "_source" : {
    "id" : 13,
    "lang" : "en",
    "question" : "What is the meaning of life?",
    "answer" : "Work",
    "keywords" : "fun, amusement, joy",
    "category_id" : 7
  }
}

Post Reply