Enhanced Search Improvements

Enhanced Search Improvements 1.3.0

No permission to download
I ended up just upgrading my PHP, which I probably should do anyway. But 5.4 is still the default/latest version available in CentOS/RHEL 7, so compatibility is good.
 
I tried IUS, but it conflicts with the native PHP package, and properly removing that to install the IUS version was more work than I wanted to do with the forum down. Ended up installing 5.6 through SCL, which doesn't conflict with anything, and lets the FastCGI work with the new PHP without any other changes.
 
  • Like
Reactions: Xon
Xon updated Enhanced Search Improvements with a new update entry:

1.2.0 - Feature Update

  • Implement the ability to use unescaped simple_query_string syntax
    • The simple_query_string supports the following special characters:
      • + signifies AND operation
      • | signifies OR operation
      • - negates a single token
      • " wraps a number of tokens to signify a phrase for searching
      • * at the end of a term signifies a prefix query
      • ( and ) signify precedence
      • ~N after a word signifies edit distance (fuzziness)
      • ~N after a phrase signifies slop amount
      ...

Read the rest of this update entry...
 
Suggestion--I don't know if this is possible without editing the core XFES add-on, but is it possible to add phonetic searching? ElasticSearch does offer it as a plugin, but I know we would need a way to interface with that from XF. Given how poor some Internet users are with their spelling, this could help a lot.

In addition, there is another plugin that enables us to define synonyms in a text file, which ES will read. Not totally essential, but it would be nice to have in the future.
 
@Xon
Enhanced Search 1.1.7 update (released yesterday) broke your Enhanced Search Improvements add-on (I'm using 1.2.0 of Improvements).

Regular search attempt gives no results whatsoever; clicking "Started threads" on membercard (I think another add-on provides this feature) gives the below error.

When I disable Enhanced Search Improvements, search returns to working and no errors are shown.

Error is:

Code:
An exception occurred: Call to undefined method XenES_Api::isSingleTypeIndex() in /home/domains/public/library/XenES/Search/SourceHandler/ElasticSearch.php on line 940

XenES_Search_SourceHandler_ElasticSearch->_processMetaDataConstraint() in XenES/Search/SourceHandler/ElasticSearch.php at line 868
XenES_Search_SourceHandler_ElasticSearch->_processConstraint() in SV/SearchImprovements/XenES/Search/SourceHandler/ElasticSearch.php at line 67
SV_SearchImprovements_XenES_Search_SourceHandler_ElasticSearch->_processConstraint() in XenES/Search/SourceHandler/ElasticSearch.php at line 200
XenES_Search_SourceHandler_ElasticSearch->executeSearch() in SV/SearchImprovements/XenES/Search/SourceHandler/ElasticSearch.php at line 9
SV_SearchImprovements_XenES_Search_SourceHandler_ElasticSearch->executeSearch() in XenForo/Search/SourceHandler/Abstract.php at line 115
XenForo_Search_SourceHandler_Abstract->searchGeneral() in XenForo/Search/Searcher.php at line 79
XenForo_Search_Searcher->searchGeneral() in XenForo/ControllerPublic/Search.php at line 362
XenForo_ControllerPublic_Search->actionMember() in XenForo/FrontController.php at line 351
XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
XenForo_FrontController->run() in /home/domains/public/index.php at line 13


Below more information:

1st Error Info
Code:
Error: Call to undefined method XenES_Api::isSingleTypeIndex() - library/XenES/Search/SourceHandler/ElasticSearch.php:940

Stack Trace
Code:
#0 /home/domains/public/library/XenES/Search/SourceHandler/ElasticSearch.php(868): XenES_Search_SourceHandler_ElasticSearch->_processMetaDataConstraint(Array, 'content', Array)
#1 /home/domains/public/library/SV/SearchImprovements/XenES/Search/SourceHandler/ElasticSearch.php(112): XenES_Search_SourceHandler_ElasticSearch->_processConstraint(Array, 'content', Array)
#2 /home/domains/public/library/XenES/Search/SourceHandler/ElasticSearch.php(200): SV_SearchImprovements_XenES_Search_SourceHandler_ElasticSearch->_processConstraint(Array, 'content', Array)
#3 /home/domains/public/library/SV/SearchImprovements/XenES/Search/SourceHandler/ElasticSearch.php(9): XenES_Search_SourceHandler_ElasticSearch->executeSearch('', true, Array, Array, false, 600, NULL)
#4 /home/domains/public/library/XenForo/Search/SourceHandler/Abstract.php(115): SV_SearchImprovements_XenES_Search_SourceHandler_ElasticSearch->executeSearch('', true, Array, Array, false, '600')
#5 /home/domains/public/library/XenForo/Search/Searcher.php(79): XenForo_Search_SourceHandler_Abstract->searchGeneral('', Array, 'date', '600')
#6 /home/domains/public/library/XenForo/ControllerPublic/Search.php(362): XenForo_Search_Searcher->searchGeneral('', Array, 'date')
#7 /home/domains/public/library/XenForo/FrontController.php(351): XenForo_ControllerPublic_Search->actionMember()
#8 /home/domains/public/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#9 /home/domains/public/index.php(13): XenForo_FrontController->run()
#10 {main}

Request State
Code:
array(3) {
  ["url"] => string(70) "https://www.ourdomain.com/search/member?user_id=3134&content=thread"
  ["_GET"] => array(3) {
    ["/search/member"] => string(0) ""
    ["user_id"] => string(4) "3134"
    ["content"] => string(6) "thread"
  }
  ["_POST"] => array(0) {
  }


2nd Error Info
Code:
Error: Call to undefined method XenES_Api::getTypeAndIdFromHit() - library/XenES/Search/SourceHandler/ElasticSearch.php:486

Stack Trace
Code:
#0 /home/domains/public/library/XenES/Search/SourceHandler/ElasticSearch.php(405): XenES_Search_SourceHandler_ElasticSearch->_getResultsFromHits(Array, false)
#1 /home/domains/public/library/SV/SearchImprovements/XenES/Search/SourceHandler/ElasticSearch.php(9): XenES_Search_SourceHandler_ElasticSearch->executeSearch('fleeting', false, Array, Array, false, 600, NULL)
#2 /home/domains/public/library/XenForo/Search/SourceHandler/Abstract.php(115): SV_SearchImprovements_XenES_Search_SourceHandler_ElasticSearch->executeSearch('fleeting', false, Array, Array, false, '600')
#3 /home/domains/public/library/XenForo/Search/Searcher.php(79): XenForo_Search_SourceHandler_Abstract->searchGeneral('fleeting', Array, 'relevance', '600')
#4 /home/domains/public/library/XenForo/ControllerPublic/Search.php(253): XenForo_Search_Searcher->searchGeneral('fleeting', Array, 'relevance')
#5 /home/domains/public/library/XenES/Proxy/ControllerSearch.php(34): XenForo_ControllerPublic_Search->actionSearch()
#6 /home/domains/public/library/SV/SearchImprovements/XenForo/ControllerPublic/Search.php(46): XenES_Proxy_ControllerSearch->actionSearch()
#7 /home/domains/public/library/XenForo/FrontController.php(351): SV_SearchImprovements_XenForo_ControllerPublic_Search->actionSearch()
#8 /home/domains/public/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#9 /home/domains/public/index.php(13): XenForo_FrontController->run()
#10 {main}

Request State
Code:
array(3) {
  ["url"] => string(42) "https://www.ourdomain.com/search/search"
  ["_GET"] => array(1) {
    ["/search/search"] => string(0) ""
  }
  ["_POST"] => array(5) {
    ["keywords"] => string(17) "fleeting"
    ["users"] => string(0) ""
    ["date"] => string(0) ""
    ["nodes"] => array(1) {
      [0] => string(1) "2"
    }
    ["_xfToken"] => string(8) "********"
  }
}
 
Last edited:
Attached is a small add-on (which depends on this add-on, Enhanced Search Improvements) which injects "Painless" script support into XFES. If Elastic Search isn't v5, this add-on will just do nothing.

Deploy the .painless script, restart elastic search to get it to load the new script and then install this add-on.

Been working fine on both my sites.

@Xon
Regarding your painless addon, we have already that file in enhanced search folder.
We need just to upload default file /public/library/XenES/_scripts/xf-date-weighted.painless to /etc/elasticsearch/scripts/ and add this to config.php $config['xfesForcePainless'] = true;
And than restart elasticsearch and rebuild index?
 
@Xon
Regarding your painless addon, we have already that file in enhanced search folder.
We need just to upload default file /public/library/XenES/_scripts/xf-date-weighted.painless to /etc/elasticsearch/scripts/ and add this to config.php $config['xfesForcePainless'] = true;
And than restart elasticsearch and rebuild index?
You don't need to re-index, just restart elasticsearch. My painless add-on isn't required as of XFES v1.1.7 (but does work with it).

With XFES 1.1.7 you do need to set xfesForcePainless
 
And of course, upload default file /public/library/XenES/_scripts/xf-date-weighted.painless to /etc/elasticsearch/scripts/?
Well yes :p Or have dynamic scripting enable.

FYI the .painless script I provided is functionally identical to XF1.1.7 verison.
 
While in the process of moving severs I've had an error that prevented any search results being returned from our forums on the new box, you can still rebuild the search it just won't do anything. Removing this add-on and @AndyB's search log add-on resolved our issues. I'm passing this along here in case it's a bug on either end.

specs:
Centos7
XenForo 1.5.14
XenForo Enhanced Search 1.1.8
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

Code:
[root@overlord ~]# curl http://127.0.0.1:9200
{
  "name" : "XYFrjcP",
  "cluster_name" : "name",
  "cluster_uuid" : "p_BVIrNNTwi3-bHqM27FUQ",
  "version" : {
    "number" : "6.1.1",
    "build_hash" : "bd92e7f",
    "build_date" : "2017-12-17T20:23:25.338Z",
    "build_snapshot" : false,
    "lucene_version" : "7.1.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

Code:
XenForo_Exception: Elasticsearch error: Content-Type header [text/json] is not supported - library/XenES/Search/SourceHandler/ElasticSearch.php:1052
Generated By: a_user, 13 minutes ago
Stack Trace
#0 /srv/www/forum/library/XenES/Search/SourceHandler/ElasticSearch.php(391): XenES_Search_SourceHandler_ElasticSearch->_logSearchResponseError(Object(stdClass), true)
#1 /srv/www/forum/library/SV/SearchImprovements/XenES/Search/SourceHandler/ElasticSearch.php(11): XenES_Search_SourceHandler_ElasticSearch->executeSearch('test', false, Array, Array, false, 200, NULL)
#2 /srv/www/forum/library/XenForo/Search/SourceHandler/Abstract.php(115): SV_SearchImprovements_XenES_Search_SourceHandler_ElasticSearch->executeSearch('test', false, Array, Array, false, '200')
#3 /srv/www/forum/library/XenForo/Search/Searcher.php(79): XenForo_Search_SourceHandler_Abstract->searchGeneral('test', Array, 'relevance', '200')
#4 /srv/www/forum/library/XenForo/ControllerPublic/Search.php(255): XenForo_Search_Searcher->searchGeneral('test', Array, 'relevance')
#5 /srv/www/forum/library/Andy/SearchLog/ControllerPublic/Search.php(8): XenForo_ControllerPublic_Search->actionSearch()
#6 /srv/www/forum/library/XenES/Proxy/ControllerSearch.php(34): Andy_SearchLog_ControllerPublic_Search->actionSearch()
#7 /srv/www/forum/library/SV/SearchImprovements/XenForo/ControllerPublic/Search.php(46): XenES_Proxy_ControllerSearch->actionSearch()
#8 /srv/www/forum/library/XenForo/FrontController.php(351): SV_SearchImprovements_XenForo_ControllerPublic_Search->actionSearch()
#9 /srv/www/forum/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#10 /srv/www/forum/index.php(13): XenForo_FrontController->run()
#11 {main}
Request State
array(3) {
  ["url"] => string(32) "https://testboard.org/search/search"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(4) {
    ["keywords"] => string(4) "test"
    ["users"] => string(0) ""
    ["date"] => string(0) ""
    ["_xfToken"] => string(8) "********"
  }
}
 
While in the process of moving severs I've had an error that prevented any search results being returned from our forums on the new box, you can still rebuild the search it just won't do anything. Removing this add-on and @AndyB's search log add-on resolved our issues. I'm passing this along here in case it's a bug on either end.

specs:
Centos7
XenForo 1.5.14
XenForo Enhanced Search 1.1.8
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

Code:
[root@overlord ~]# curl http://127.0.0.1:9200
{
  "name" : "XYFrjcP",
  "cluster_name" : "name",
  "cluster_uuid" : "p_BVIrNNTwi3-bHqM27FUQ",
  "version" : {
    "number" : "6.1.1",
    "build_hash" : "bd92e7f",
    "build_date" : "2017-12-17T20:23:25.338Z",
    "build_snapshot" : false,
    "lucene_version" : "7.1.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

Code:
XenForo_Exception: Elasticsearch error: Content-Type header [text/json] is not supported - library/XenES/Search/SourceHandler/ElasticSearch.php:1052
Generated By: a_user, 13 minutes ago
Stack Trace
#0 /srv/www/forum/library/XenES/Search/SourceHandler/ElasticSearch.php(391): XenES_Search_SourceHandler_ElasticSearch->_logSearchResponseError(Object(stdClass), true)
#1 /srv/www/forum/library/SV/SearchImprovements/XenES/Search/SourceHandler/ElasticSearch.php(11): XenES_Search_SourceHandler_ElasticSearch->executeSearch('test', false, Array, Array, false, 200, NULL)
#2 /srv/www/forum/library/XenForo/Search/SourceHandler/Abstract.php(115): SV_SearchImprovements_XenES_Search_SourceHandler_ElasticSearch->executeSearch('test', false, Array, Array, false, '200')
#3 /srv/www/forum/library/XenForo/Search/Searcher.php(79): XenForo_Search_SourceHandler_Abstract->searchGeneral('test', Array, 'relevance', '200')
#4 /srv/www/forum/library/XenForo/ControllerPublic/Search.php(255): XenForo_Search_Searcher->searchGeneral('test', Array, 'relevance')
#5 /srv/www/forum/library/Andy/SearchLog/ControllerPublic/Search.php(8): XenForo_ControllerPublic_Search->actionSearch()
#6 /srv/www/forum/library/XenES/Proxy/ControllerSearch.php(34): Andy_SearchLog_ControllerPublic_Search->actionSearch()
#7 /srv/www/forum/library/SV/SearchImprovements/XenForo/ControllerPublic/Search.php(46): XenES_Proxy_ControllerSearch->actionSearch()
#8 /srv/www/forum/library/XenForo/FrontController.php(351): SV_SearchImprovements_XenForo_ControllerPublic_Search->actionSearch()
#9 /srv/www/forum/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#10 /srv/www/forum/index.php(13): XenForo_FrontController->run()
#11 {main}
Request State
array(3) {
  ["url"] => string(32) "https://testboard.org/search/search"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(4) {
    ["keywords"] => string(4) "test"
    ["users"] => string(0) ""
    ["date"] => string(0) ""
    ["_xfToken"] => string(8) "********"
  }
}
This is a known error with v1.2.3 of this add-on, fixed with v1.2.4

(I've updated v1.2.4's description to indicate this)
 
Top Bottom