Resource icon

Username auto-complete using XFES [Paid] 1.7.1

No permission to buy ($20.00)

Xon

Well-known member
Xon submitted a new resource:

Username auto-complete using XFES - Username auto-complete powered by elasticsearch

  • Replace the stock MySQL-powered username autocomplete with Elasticsearch powered version.
    • Supports partial matching, non-prefix search.
    • Autocomplete is tuned for usernames over text phrases compared to ElasticSearch Essential's autocomplete support
    • Better performance than stock when a large number of users exist
  • Surfaces additional options to control autocomplete
    • Tuning of how "fuzzy" the search is
    • To skip inactive users, and the threshold to...

Read more about this resource...
 
1) It would be nice to have this functionality when searching for username in /login/register form, too.

2) Wondering is it possible to search as prefix only, i.e. to match username starting with some word, instead of matching in the middle of the username as it is now?
 
1) It would be nice to have this functionality when searching for username in /login/register form, too.
XF's username autocomplete (for text entry fields) doesn't really work sanely for something like a new username field in the signup form.

2) Wondering is it possible to search as prefix only, i.e. to match username starting with some word, instead of matching in the middle of the username as it is now?
It tends to prefer a prefix match where possible, tuning the matching is a little tricky without losing useful funcitonality.
 
XF's username autocomplete (for text entry fields) doesn't really work sanely for something like a new username field in the signup form.
Actually I was thinking about /misc/validate-username endpoint, so XF would check if the username exist via your add-on (because it better matches all character variants).

It tends to prefer a prefix match where possible, tuning the matching is a little tricky without losing useful funcitonality.
But it doesn't make mush sense that when typing @mas you see "tomas" in the autocomplete list. It should display usernames starting with "mas" only.
 
Last edited:
Hey @Xon the default fuzzy matching is set to "AUTO:0,1" but also gives a warning this might cause performance issues.

Is there a better setting you would recommend that provides a lower level of fuzzy searching without full on turning it off?
 
The defaults are reasonable enough, it is just tinkering with it can increase how fuzzy it accepts which can actually degrade how useful the username search is. The current setting works well enough.

Honestly, most sites using Elasticsearch aren't going to be sending too many queries at elasticsearch even with this add-on. User mentions and tag lookups are frankly rare.
 
Updating this add-on for XF2.3 is currently blocked while I look into a work-around for this bug:

 
The last task during upgrade from 1.6.0 to 1.6.2 failed with timeout connecting to Elasticsearch.

Tried optimizing "Users" index, but it reports again:
Code:
XFES\Elasticsearch\ConnectException: cURL error 28: Operation timed out after 20000 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://localhost:9200/xenforo_sv_user in src/addons/XFES/Elasticsearch/Api.php at line 462
XFES\Elasticsearch\Api->request() in src/addons/XFES/Elasticsearch/Api.php at line 363
XFES\Elasticsearch\Api->createIndex() in src/addons/SV/SearchImprovements/Service/Specialized/Optimizer.php at line 82
SV\SearchImprovements\Service\Specialized\Optimizer->optimize() in src/addons/XFES/Admin/Controller/EnhancedSearch.php at line 196
XFES\Admin\Controller\EnhancedSearch->actionOptimize() in src/XF/Mvc/Dispatcher.php at line 362
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 264
XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 121
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 63
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2826
XF\App->run() in src/XF.php at line 806
XF::runApp() in admin.php at line 15
Tried rebuilding "Users" index and it's the same:
Code:
# php cmd.php xf-rebuild:search-bulk -n --restart=0 --content-type=sv_user
Building bulk-insert workload...
sv_user to index upto xxx items
Deleting index: sv_user

In Api.php line 462:
                                                                                                                                                                                        
  [XFES\Elasticsearch\ConnectException]                                                                                                                                                 
  cURL error 28: Operation timed out after 20001 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://localhost:9200/xenforo_sv_user  
                                                                                                                                                                                        
Exception trace:
  at /home/xenforo/src/addons/XFES/Elasticsearch/Api.php:462
 XFES\Elasticsearch\Api->request() at /home/xenforo/src/addons/XFES/Elasticsearch/Api.php:363
 XFES\Elasticsearch\Api->createIndex() at /home/xenforo/src/addons/SV/SearchImprovements/Service/Specialized/Optimizer.php:82
 SV\SearchImprovements\Service\Specialized\Optimizer->optimize() at /home/xenforo/src/addons/SV/SearchImprovements/Search/Specialized/Source.php:199
 SV\SearchImprovements\Search\Specialized\Source->truncate() at /home/xenforo/src/XF/Search/Search.php:175
 XF\Search\Search->truncate() at /home/xenforo/src/addons/SV/SearchImprovements/XF/Search/SearchPatch.php:229
 SV\SearchImprovements\XF\Search\SearchPatch->truncate() at /home/xenforo/src/addons/SV/SearchImprovements/XF/Search/SearchPatch.php:224
 SV\SearchImprovements\XF\Search\SearchPatch->truncate() at /home/xenforo/src/addons/SV/ElasticSearchEssentials/Cli/Command/BulkSearch.php:428
 SV\ElasticSearchEssentials\Cli\Command\BulkSearch->execute() at /home/xenforo/src/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at /home/xenforo/src/vendor/symfony/console/Application.php:1040
 Symfony\Component\Console\Application->doRunCommand() at /home/xenforo/src/vendor/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at /home/xenforo/src/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at /home/xenforo/src/XF/Cli/Runner.php:115
 XF\Cli\Runner->run() at /home/xenforo/cmd.php:17

In CurlFactory.php line 210:
                                                                                                                                                                                        
  [GuzzleHttp\Exception\ConnectException]                                                                                                                                               
  cURL error 28: Operation timed out after 20001 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://localhost:9200/xenforo_sv_user  
                                                                                                                                                                                       
Exception trace:
  at /home/xenforo/src/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:210
 GuzzleHttp\Handler\CurlFactory::createRejection() at /home/xenforo/src/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:158
 GuzzleHttp\Handler\CurlFactory::finishError() at /home/xenforo/src/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:110
 GuzzleHttp\Handler\CurlFactory::finish() at /home/xenforo/src/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php:47
 GuzzleHttp\Handler\CurlHandler->__invoke() at /home/xenforo/src/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php:28
 GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}() at /home/xenforo/src/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php:64
 GuzzleHttp\PrepareBodyMiddleware->__invoke() at /home/xenforo/src/vendor/guzzlehttp/guzzle/src/Middleware.php:31
 GuzzleHttp\Middleware::GuzzleHttp\{closure}() at /home/xenforo/src/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php:71
 GuzzleHttp\RedirectMiddleware->__invoke() at /home/xenforo/src/vendor/guzzlehttp/guzzle/src/Middleware.php:63
 GuzzleHttp\Middleware::GuzzleHttp\{closure}() at /home/xenforo/src/vendor/guzzlehttp/guzzle/src/HandlerStack.php:75
 GuzzleHttp\HandlerStack->__invoke() at /home/xenforo/src/vendor/guzzlehttp/guzzle/src/Client.php:333
 GuzzleHttp\Client->transfer() at /home/xenforo/src/vendor/guzzlehttp/guzzle/src/Client.php:106
 GuzzleHttp\Client->sendAsync() at /home/xenforo/src/vendor/guzzlehttp/guzzle/src/Client.php:124
 GuzzleHttp\Client->send() at /home/xenforo/src/addons/XFES/Elasticsearch/Api.php:430
 XFES\Elasticsearch\Api->request() at /home/xenforo/src/addons/XFES/Elasticsearch/Api.php:363
 XFES\Elasticsearch\Api->createIndex() at /home/xenforo/src/addons/SV/SearchImprovements/Service/Specialized/Optimizer.php:82
 SV\SearchImprovements\Service\Specialized\Optimizer->optimize() at /home/xenforo/src/addons/SV/SearchImprovements/Search/Specialized/Source.php:199
 SV\SearchImprovements\Search\Specialized\Source->truncate() at /home/xenforo/src/XF/Search/Search.php:175
 XF\Search\Search->truncate() at /home/xenforo/src/addons/SV/SearchImprovements/XF/Search/SearchPatch.php:229
 SV\SearchImprovements\XF\Search\SearchPatch->truncate() at /home/xenforo/src/addons/SV/SearchImprovements/XF/Search/SearchPatch.php:224
 SV\SearchImprovements\XF\Search\SearchPatch->truncate() at /home/xenforo/src/addons/SV/ElasticSearchEssentials/Cli/Command/BulkSearch.php:428
 SV\ElasticSearchEssentials\Cli\Command\BulkSearch->execute() at /home/xenforo/src/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at /home/xenforo/src/vendor/symfony/console/Application.php:1040
 Symfony\Component\Console\Application->doRunCommand() at /home/xenforo/src/vendor/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at /home/xenforo/src/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at /home/xenforo/src/XF/Cli/Runner.php:115
 XF\Cli\Runner->run() at /home/xenforo/cmd.php:17

The only solution is to purge all indexes, then optimize both "Default Index" and "Users".

Then execute php cmd.php xf-rebuild:search-bulk -n --restart=0
 
Something with your elasticsearch instance must have been in a wonky state. I updated a few large sites I do sysadmin for without any issues.
 
Back
Top Bottom