Search Improvements

Search Improvements 2.13.1

No permission to download
How difficult would be be to further extend the Default Search options to apply differently to each Node in a forum?

For instance....Relevance provides the most effective Search results for Tech-type questions (ie: how do I set my ignition timing) but Most Recent offers better results for searching Classifieds sections.

Setup Options in the ACP could retain the default setting ability. Then each Node could default to the main, with the ability to change individual nodes to the other alternatives.

---------------------------------
EDIT: an alternative idea:

Add two Radio Buttons in the Quick Search box, one for Relevance, one for Most Recent - Obviously, one is the Default per the Admin settings.
 
Xon updated Search Improvements with a new update entry:

2.4.3 - Maintenance update

  • Improve extendibility of weight-by-content-type feature (Allow custom searches to opt-in to content weighting for single type searches)
  • Improve compatibility with ElasticSearch v7+
  • Support float-point weight values in weight by content-type
  • Ensure XFES doesn't swallow the actual error message for a query failing instead of "all shards failed" message (backport for older versions of XFES)

Read the rest of this update entry...
 
@Xon I seem to be getting a few errors periodically related to this addon and I was wondering if you could point me in the right direction on how to solve it :)

this is with xf 2.2.3 P1 and Search Improvements 2.4.6

Code:
    Error: Macro public:message_macros :: user_info() error: Call to a member function isPrivacyCheckMet() on null src/XF/Entity/User.php:934

    Generated by: Zack Frost Feb 10, 2021 at 4:58 PM

Stack trace

#0 [internal function]: XF\Entity\User->canStartConversationWith(Object(SV\SearchImprovements\XF\Entity\User))
#1 src/XF/Template/Templater.php(1166): call_user_func_array(Array, Array)
#2 internal_data/code_cache/templates/l3/s115/public/message_macros.php(95): XF\Template\Templater->method(Object(SV\SearchImprovements\XF\Entity\User), 'canStartConvers...', Array)
#3 src/XF/Template/Templater.php(799): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array, NULL)
#4 internal_data/code_cache/templates/l3/s115/public/post_macros.php(31): XF\Template\Templater->callMacro('message_macros', 'user_info', Array, Array)
#5 src/XF/Template/Templater.php(962): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
#6 src/XF/Template/Templater.php(898): XF\Template\Templater->renderExtensionInternal('user_cell', Array, Array, Object(XF\Template\ExtensionSet))
#7 internal_data/code_cache/templates/l3/s115/public/post_macros.php(167): XF\Template\Templater->renderExtension('user_cell', Array, Object(XF\Template\ExtensionSet))
#8 src/XF/Template/Templater.php(962): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
#9 src/XF/Template/Templater.php(898): XF\Template\Templater->renderExtensionInternal('full_body', Array, Array, Object(XF\Template\ExtensionSet))
#10 internal_data/code_cache/templates/l3/s115/public/post_macros.php(224): XF\Template\Templater->renderExtension('full_body', Array, Object(XF\Template\ExtensionSet))
#11 src/XF/Template/Templater.php(799): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
#12 internal_data/code_cache/templates/l3/s115/public/thread_view.php(1035): XF\Template\Templater->callMacro('post_macros', 'post', Array, Array)
#13 src/XF/Template/Templater.php(1626): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
#14 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('thread_view', Array)
#15 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
#16 src/XF/Mvc/Dispatcher.php(458): XF\Mvc\Renderer\Html->renderView('XF:Thread\\View', 'public:thread_v...', Array)
#17 src/XF/Mvc/Dispatcher.php(440): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#18 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#19 src/XF/Mvc/Dispatcher.php(58): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#20 src/XF/App.php(2326): XF\Mvc\Dispatcher->run()
#21 src/XF.php(488): XF\App->run()
#22 index.php(20): XF::runApp('XF\\Pub\\App')
#23 {main}

Request state

array(4) {
  ["url"] => string(42) "/threads/heyo-howdy-my-name-is-riki.42052/"
  ["referrer"] => bool(false)
  ["_GET"] => array(1) {
    ["/threads/heyo-howdy-my-name-is-riki_42052/"] => string(0) ""
  }
  ["_POST"] => array(0) {
  }
}
 
Assuming you have my standard library add-on installed;

@electrogypsy Can you go to the message_macros template and click the "view template modifications" link? And on the "compilied" tab dump the contents of line 94-96 ?

This looks to possible be a bug with XF.
 
Assuming you have my standard library add-on installed;

@electrogypsy Can you go to the message_macros template and click the "view template modifications" link? And on the "compilied" tab dump the contents of line 94-96 ?

This looks to possible be a bug with XF.

Sure, that tab doesn't include line numbers, but I copied and pasted it into notepad++ and got the line numbers that way so hopefully this is correct:

Code:
';
        if ($__vars['__globals']['thread'] AND ($__vars['user']['user_id'] AND $__templater->method($__vars['xf']['visitor'], 'canStartConversationWith', array($__vars['user'], )))) {
            $__finalCompiled .= '
 
Great addon (y)

I would like to suggest a new feature: A date/age related weighting for elastic search.

I often encounter the problem that I get very old results in my forum search (my forum is 7+ years old), while my discussion topics are very short-lifed and get old very quickly. While the old threads might match or be relevant to the search term, they are not very relevant for the user searching for them today. So my community would benefit of a feature that pushes newer threads compared to older threads by a weighting factor or something similar.

I would also be ready to buy a paid addon, I have a lot of your premium addons and I'm very happy with your work and support!
 
@Xon, can you share some examples of weighting if you wanted prioritize results like this:

posts
threads
conversations

Not sure what values to use, or how high to go with them.
 
A lot part of that is experimentation, I can't really offer any significant advice as this is an advanced feature and highly dependent on your content
 
What does the permission "Search Options" enable?
It adds a new "Search options" preference which allows them to configure the default search order per user.
1623720902704.webp


ElasticSearch Essentials then adds an "include deleted" preference for moderators to this section (if it exists)
 
I reinstalled Easticsearch after a long delay following an upgrde to cPanel that lost/broke the installation. It appears to be working correctly.

I had been busy and did not look at the error log for several weeks and today I found 30,000+ errors like this one.
Code:
[LIST]
[*]ErrorException: {"sort":["_score",{"date":"desc"}],"docvalue_fields":["discussion_id","user","date"],"_source":false,"size":"200","query":{"function_score":{"query":{"bool":{"must":{"function_score":{"query":{"simple_query_string":{"query":"JOHN BENNETT","fields":["title","message"],"default_operator":"and"}},"functions":[{"exp":{"date":{"origin":1630602613,"decay":0.5,"scale":31536000}}}]}},"must_not":[{"exists":{"field":"hidden"}},{"terms":{"node":[281,26,282,27,283,231,349,354,357,352,351,350,345,348,346,347,362,353,359,361,360,344,355,356,358,375,284,371,317,47,437,423,473,417,418,419,424,428,433,415,414,24,43,36,292,380,373,39,266,289,290,291,34,381,408,409]}}]}},"functions":[{"filter":{"term":{"type":"page"}},"weight":2},{"filter":{"term":{"type":"post"}},"weight":10},{"filter":{"term":{"type":"thread"}},"weight":15},{"filter":{"term":{"type":"vwpage"}},"weight":20},{"filter":{"term":{"type":"xfmg_album"}},"weight":5},{"filter":{"term":{"type":"xfmg_comment"}},"weight":2},{"filter":{"term":{"type":"xfmg_media"}},"weight":5}]}}}
[*]src/XF/Error.php:75
[*]Generated by: myk
[*]Sep 2, 2021 at 1:10 PM
[/LIST]
[HEADING=2]Stack trace[/HEADING]
#0 src/XF.php(184): XF\Error->logError('{"sort":["_scor...', false)
#1 src/addons/SV/SearchImprovements/XFES/Elasticsearch/Api.php(26): XF::logError('{"sort":["_scor...')
#2 src/addons/XFES/Search/Source/Elasticsearch.php(153): SV\SearchImprovements\XFES\Elasticsearch\Api->search(Array)
#3 src/XF/Search/Search.php(175): XFES\Search\Source\Elasticsearch->search(Object(SV\SearchImprovements\XF\Search\Query\Query), '200')
#4 src/XF/Repository/Search.php(34): XF\Search\Search->search(Object(SV\SearchImprovements\XF\Search\Query\Query))
#5 src/XF/Pub/Controller/Search.php(402): XF\Repository\Search->runSearch(Object(SV\SearchImprovements\XF\Search\Query\Query), Array, true)
#6 src/XF/Pub/Controller/Search.php(113): XF\Pub\Controller\Search->runSearch(Object(SV\SearchImprovements\XF\Search\Query\Query), Array)
#7 src/addons/SV/SearchImprovements/XF/Pub/Controller/Search.php(58): XF\Pub\Controller\Search->actionSearch()
#8 src/XF/Mvc/Dispatcher.php(350): SV\SearchImprovements\XF\Pub\Controller\Search->actionSearch(Object(XF\Mvc\ParameterBag))
#9 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:Search', 'Search', Object(XF\Mvc\RouteMatch), Object(SV\SearchImprovements\XF\Pub\Controller\Search), NULL)
#10 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(SV\SearchImprovements\XF\Pub\Controller\Search), NULL)
#11 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#12 src/XF/App.php(2191): XF\Mvc\Dispatcher->run()
#13 src/XF.php(391): XF\App->run()
#14 index.php(20): XF::runApp('XF\\Pub\\App')
#15 {main}
[HEADING=2]Request state[/HEADING]
array(4) {
  ["url"] => string(14) "/search/search"
  ["referrer"] => string(34) "https://mb.nawcc.org/search/search"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(3) {
    ["keywords"] => string(13) "JOHN BENNETT "
    ["c"] => array(1) {
      ["users"] => string(0) ""
    }
    ["_xfToken"] => string(8) "********"
  }
}
I just now upgraded Search Improvements to the current release and when Ichecked the error log, there are another dozen or so instances of this error. The are coming every 4 to 6 minutes.

Any ideeas?
 
Top Bottom