Search Improvements

Search Improvements 2.17.0

No permission to download
I'ld probably put it behind a style property, but frankly a search icon on the end after the area selector would work a lot better than the current solution.

:edit: I might release it as a template modification in a standalone add-on as the template modification to implement this is kinda hairy and making it conditional would be fairly complicated over just making it a trivially small add-on
1724633153536.webp
 
Last edited:
I'ld probably put it behind a style property, but frankly a search icon on the end after the area selector would work a lot better than the current solution.
I like your suggestion, but I was specifically talking about the linked comment, not the OP.

IE:
Relatedly, "show results as threads" is arguably the most important "advanced option", so I think it deserves its own checkbox next to "search titles only".

An alternative is to have an easy option to "show results as threads" on the search results page.

I think people who are new to XF search will find the default search results to be quite overwhelming and undesirable, especially for large forums. I personally had this issue until I happened to check out and experiment with the advanced options.
 
While installing the 2.15.9 i get the following:

ErrorException: [E_WARNING] include(/var/www/res1_kd_0003/htdocs/src/vendor/composer/../../../src/addons/XFES/Listener.php): Failed to open stream: No such file or directory in src/vendor/composer/ClassLoader.php at line 576
  1. XF::handlePhpError() in src/vendor/composer/ClassLoader.php at line 576
  2. include() in src/vendor/composer/ClassLoader.php at line 576
  3. Composer\Autoload\{closure}() in src/vendor/composer/ClassLoader.php at line 427
  4. Composer\Autoload\ClassLoader->loadClass() in src/addons/SV/StandardLib/InstallerHelper.php at line 678
  5. SV\SearchImprovements\Setup->checkElasticSearchOptimizableState() in src/addons/SV/SearchImprovements/Setup.php at line 120
  6. SV\SearchImprovements\Setup->postUpgrade() in src/XF/AddOn/AddOn.php at line 595
  7. XF\AddOn\AddOn->postUpgrade() in src/XF/Admin/Controller/AddOn.php at line 768
  8. XF\Admin\Controller\AddOn->actionFinalize() in src/XF/Mvc/Dispatcher.php at line 352
  9. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 258
  10. XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 115
  11. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 57
  12. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2487
  13. XF\App->run() in src/XF.php at line 524
  14. XF::runApp() in admin.php at line 13
 
Error: Interface "SV\SearchImprovements\Search\Features\ISearchableDiscussionUser" not found in src/addons/SV/SearchImprovements/XF/Entity/Thread.php at line 17
 
This can also briefly occur when updating the add-on. If it reoccurs make sure you've uploaded all the files for the add-on.
 
  • Like
Reactions: Bob
Hello @Xon

Got a ton of this this on search rebuild
Code:
ErrorException: {"sort":["_score",{"date":"desc"}],"docvalue_fields":["discussion_id","user","date"],"_source":false,"size":30,"query":{"bool":{"filter":[{"term":{"type":"thread"}},{"bool":{"must_not":[{"terms":{"node":[75,3,119,126,110,113,72,17,136,70]}}]}},{"range":{"last_update":{"gt":1716122675}}}],"must_not":[{"exists":{"field":"hidden"}},{"terms":{"node":[146,158,155,140,148,139]}},{"term":{"thread":7965}}],"must":[{"function_score":{"query":{"multi_match":{"type":"most_fields","query":"\u0420\u0443\u0431\u0430\u043b\u0435\u043a (rubalek.ru) \/ \u041c\u041a\u041a \u0421\u0438\u043c\u0435\u0442\u0440\u0430 - \u043e\u0442\u0437\u044b\u0432\u044b \u043e\u0442\u0437\u044b\u0432\u044b \u0440\u0443\u0431\u0430\u043b\u0435\u043a","operator":"or","fields":["title^1.5","elasticess_title","title.exact^2"]}},"functions":[{"filter":{"term":{"node":5}},"weight":1.5}]}}]}}} src/XF/Error.php:77
Сгенерирована пользователем: Неизвестная учётная запись 15 Ноя 2024 в 15:44
Трассировка стека
#0 src/XF.php(219): XF\Error->logError('{"sort":["_scor...', false)
#1 src/addons/SV/SearchImprovements/XFES/Elasticsearch/Api.php(48): XF::logError('{"sort":["_scor...')
#2 src/addons/XFES/Search/Source/Elasticsearch.php(750): SV\SearchImprovements\XFES\Elasticsearch\Api->search(Array)
#3 src/addons/SV/SearchImprovements/XFES/Search/Source/Elasticsearch.php(332): XFES\Search\Source\Elasticsearch->executeSearch(Object(SV\ElasticSearchEssentials\XF\Search\Query\KeywordQuery), Array, 30)
#4 src/addons/XFES/Search/Source/Elasticsearch.php(145): SV\SearchImprovements\XFES\Search\Source\Elasticsearch->executeSearch(Object(SV\ElasticSearchEssentials\XF\Search\Query\KeywordQuery), Array, 30)
#5 src/XF/Search/Search.php(185): XFES\Search\Source\Elasticsearch->search(Object(SV\ElasticSearchEssentials\XF\Search\Query\KeywordQuery), 30)
#6 src/XF/Search/Search.php(214): XF\Search\Search->XF\Search\{closure}(Object(SV\ElasticSearchEssentials\XF\Search\Query\KeywordQuery), 30)
#7 src/addons/SV/ElasticSearchEssentials/XF/Search/Search.php(48): XF\Search\Search->executeSearch(Object(SV\ElasticSearchEssentials\XF\Search\Query\KeywordQuery), 30, Object(Closure), true)
#8 src/XF/Search/Search.php(180): SV\ElasticSearchEssentials\XF\Search\Search->executeSearch(Object(SV\ElasticSearchEssentials\XF\Search\Query\KeywordQuery), 30, Object(Closure), true)
#9 src/addons/SV/ElasticSearchEssentials/Service/AutoCompleter.php(539): XF\Search\Search->search(Object(SV\ElasticSearchEssentials\XF\Search\Query\KeywordQuery), 30, true)
#10 src/addons/SV/ElasticSearchEssentials/Service/SimilarContentFinder.php(367): SV\ElasticSearchEssentials\Service\AutoCompleter->getResults()
#11 src/addons/SV/ElasticSearchEssentials/XFES/Widget/SimilarThreads.php(95): SV\ElasticSearchEssentials\Service\SimilarContentFinder->getSimilarContents()
#12 src/addons/SV/ElasticSearchEssentials/XFES/Widget/SimilarThreads.php(76): SV\ElasticSearchEssentials\XFES\Widget\SimilarThreads->getSimilarThreadIdsFromEss(Object(SV\SearchImprovements\XF\Entity\ThreadCollab))
#13 src/addons/SV/ElasticSearchEssentials/XFES/Widget/SimilarThreads.php(56): SV\ElasticSearchEssentials\XFES\Widget\SimilarThreads->getSimilarThreadFromEss(Object(SV\SearchImprovements\XF\Entity\ThreadCollab))
#14 src/addons/XFES/Widget/SimilarThreads.php(61): SV\ElasticSearchEssentials\XFES\Widget\SimilarThreads->getSimilarThreadsCache(Object(SV\SearchImprovements\XF\Entity\ThreadCollab))
#15 src/addons/SV/ElasticSearchEssentials/XFES/Widget/SimilarThreads.php(39): XFES\Widget\SimilarThreads->render()
#16 internal_data/code_cache/widgets/_41_xfes_thread_view_below_quick_reply_similar_threads.php(5): SV\ElasticSearchEssentials\XFES\Widget\SimilarThreads->render()
#17 src/XF/Template/Templater.php(7729): XF\SubContainer\Widget->{closure}(Object(NF\Tickets\XF\Template\Templater), Array, Array)
#18 src/XF/SubContainer/Widget.php(168): XF\Template\Templater->renderWidgetClosure(Object(Closure), Array)
#19 src/XF/Template/Templater.php(1940): XF\SubContainer\Widget->getCompiledWidget(Array, Array)
#20 internal_data/code_cache/templates/l9/s28/public/thread_view.php(1754): XF\Template\Templater->widgetPosition('sv_thread_view_...', Array)
#21 src/XF/Template/Templater.php(1655): XF\Template\Templater->{closure}(Object(NF\Tickets\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
#22 src/addons/MaZ/AUN/XF/Template/Templater.php(39): XF\Template\Templater->renderTemplate('thread_view', Array, true, NULL)
#23 src/XF/Template/Template.php(24): MaZ\AUN\XF\Template\Templater->renderTemplate('public:thread_v...', Array)
#24 src/XF/Mvc/Renderer/Html.php(50): XF\Template\Template->render()
#25 src/XF/Mvc/Dispatcher.php(460): XF\Mvc\Renderer\Html->renderView('XF:Thread\\View', 'public:thread_v...', Array)
#26 src/XF/Mvc/Dispatcher.php(442): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#27 src/XF/Mvc/Dispatcher.php(402): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#28 src/XF/Mvc/Dispatcher.php(60): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#29 src/XF/App.php(2485): XF\Mvc\Dispatcher->run()
#30 src/XF.php(524): XF\App->run()
#31 index.php(20): XF::runApp('XF\\Pub\\App')
#32 {main}
Содержимое запроса
array(4) {
  ["url"] => string(58) "/forum/threads/rubalek-rubalek-ru-mkk-simetra-otzyvy.7965/"
  ["referrer"] => string(23) "https://www.google.com/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}

also having issue with search by user when user have posts but search shows nothing
(example https://findozor.net/forum/members/autsajder.24488/)
1731674912860.webp
xenforo 2.2.16
searche improvements 2.16.1
ElasticSearch Essentials 3.16.5
XenForo Enhanced Search 2.2.2
 
Someone turned on the "Log search DSL" option, which is dumping the search query into the XF error log

also having issue with search by user when user have posts but search shows nothing
Check the number of documents in elasticsearch (elasticsearch setup page shows it) is the same or greater than the number of posts. If someone reset the search index it'll be much lower than you expect and you'll need to re-index the site.
 
XF 2.3.4 PHP 8.3.14 Search Improvements 2.16.1
@Xon any thoughts on this error?

Code:
Server error log
[LIST]
[*]TypeError: array_merge(): Argument #2 must be of type array, null given
[*]src/XF/Search/Search.php:294
[*]Generated by: blacksheelpone
[*]Nov 27, 2024 at 7:00 PM
[/LIST]
[HEADING=2]Stack trace[/HEADING]
#0 src/XF/Search/Search.php(294): array_merge(Array, NULL)
#1 src/XF/ResultSet.php(129): XF\Search\Search->XF\Search\{closure}(Object(SV\SearchImprovements\XF\Entity\ThreadCollab), 'thread', 31226)
#2 src/XF/Search/Search.php(285): XF\ResultSet->getResultsDataCallback(Object(Closure))
#3 src/XF/Pub/Controller/SearchController.php(123): XF\Search\Search->getAutoCompleteResults(Object(XF\ResultSet), Array)
#4 src/XF/Mvc/Dispatcher.php(362): XF\Pub\Controller\SearchController->actionAutoComplete(Object(XF\Mvc\ParameterBag))
#5 src/XF/Mvc/Dispatcher.php(264): XF\Mvc\Dispatcher->dispatchClass('XF:Search', 'AutoComplete', Object(XF\Mvc\RouteMatch), Object(SV\SearchImprovements\XF\Pub\Controller\SearchPatchFirst), NULL)
#6 src/XF/Mvc/Dispatcher.php(121): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(SV\SearchImprovements\XF\Pub\Controller\SearchPatchFirst), NULL)
#7 src/XF/Mvc/Dispatcher.php(63): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#8 src/XF/App.php(2826): XF\Mvc\Dispatcher->run()
#9 src/XF.php(806): XF\App->run()
#10 index.php(23): XF::runApp('XF\\Pub\\App')
#11 {main}
[HEADING=2]Request state[/HEADING]
array(4) {
  ["url"] => string(31) "/community/search/auto-complete"
  ["referrer"] => string(47) "https://jeep-cj.com/community/search/?type=post"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(8) {
    ["_xfToken"] => string(8) "********"
    ["keywords"] => string(12) "blower motor"
    ["c"] => array(6) {
      ["users"] => string(0) ""
      ["newer_than"] => string(0) ""
      ["older_than"] => string(0) ""
      ["min_reply_count"] => string(1) "0"
      ["nodes"] => array(1) {
        [0] => string(1) "1"
      }
      ["child_nodes"] => string(1) "1"
    }
    ["order"] => string(9) "relevance"
    ["search_type"] => string(4) "post"
    ["_xfResponseType"] => string(4) "json"
    ["_xfWithData"] => string(1) "1"
    ["_xfRequestUri"] => string(28) "/community/search/?type=post"
  }
}
 
This is an XF bug. my code isn't actually responsible for that.

This can happen when a thread doesn't have a first post. This can be caused by bad data, or a race between between when a thread is converted into a redirect but search hasn't been updated yet.
 
Last edited:
Not sure if this is the correct place to report this, but phrase svSearchImprov_search_container.report seems to be missing.

So if https://xenforo.com/community/resources/report-improvements-by-xon.6905/ is used, the following template code will be executed:
Code:
<xf:set var="$phrase" value="{{ phrase_dynamic('svSearchImprov_search_container.'.$containerType) }}" />
<xf:set var="$label" value="{{
$phrase !== 'svSearchImprov_search_container.'.$containerType 
    ? $phrase 
    : phrase('svSearchImprov_search_container.x_only', {
        'containerType': $xf.app.getContentTypePhrase($containerType, true)|to_lower
    }) 
}}" />

As the phrase does not exist the content of variable $phrase becomes svSearchImprov_search_container.report and thus phrase svSearchImprov_search_container.x_only is used with parameter containerType set to the lowercase of the content type plural phrase.

This works fine for english (eg. reports) , but at least in German the phrase needs to be uppercase.

Could this be fixed by providing the requried phrase, either by this Add-on or by Report Improvements?

Alternatively (or additionally, would be appreciated to cover potential 3rd party content types) you could probably check $xf.language.language_code and conditionally apply lowercase only for those languages that need it?
 
Not sure if this is the correct place to report this, but phrase svSearchImprov_search_container.report seems to be missing.

So if https://xenforo.com/community/resources/report-improvements-by-xon.6905/ is used, the following template code will be executed:
Code:
<xf:set var="$phrase" value="{{ phrase_dynamic('svSearchImprov_search_container.'.$containerType) }}" />
<xf:set var="$label" value="{{
$phrase !== 'svSearchImprov_search_container.'.$containerType
    ? $phrase
    : phrase('svSearchImprov_search_container.x_only', {
        'containerType': $xf.app.getContentTypePhrase($containerType, true)|to_lower
    })
}}" />

As the phrase does not exist the content of variable $phrase becomes svSearchImprov_search_container.report and thus phrase svSearchImprov_search_container.x_only is used with parameter containerType set to the lowercase of the content type plural phrase.

This works fine for english (eg. reports) , but at least in German the phrase needs to be uppercase.

Could this be fixed by providing the requried phrase, either by this Add-on or by Report Improvements?

Alternatively (or additionally, would be appreciated to cover potential 3rd party content types) you could probably check $xf.language.language_code and conditionally apply lowercase only for those languages that need it?
I think that should be reported as part of Report Improvements. I'm still catching up on tasks from my break over December/January, but a PR on the github repo for this add-on would help speed that up:

 
So, what does the requirement: "If installed: Redis Cache addon v2.17.0+" mean?

Does this mean if you have the redis cache addon it needs to be at least 2.17.0, or, does this mean if you install the search improvement add-on you will need the redis cache addon at 2.17.0+?
 
Back
Top Bottom