Upon investigation of a batch reindex, it was discovered that user data is the only data that seems to be indexed.
Steps to reproduce
- Create 3 nodes test1, test2, test10
- create 3 users test1,test2, test10
- enable views natural sort
- run
drush sqlq "select * from views_natural_sort"
Expected result
Node titles should be in there.
Original Title
Doesn't work with PHP 7.3
Original Summary
I installed this module and tried to index but get this
Notice: unserialize(): Error at offset 23011 of 39168 bytes in Drupal\Core\Batch\BatchStorage->load() (line 71 of core/lib/Drupal/Core/Batch/BatchStorage.php).
Drupal\Core\Batch\BatchStorage->load('1269') (Line: 75)
Drupal\Core\ProxyClass\Batch\BatchStorage->load('1269') (Line: 43)
_batch_page(Object) (Line: 55)
Drupal\system\Controller\BatchController->batchPage(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Making the module unusable because it does not sort.
Issue fork views_natural_sort-3185945
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
smustgrave CreditAttribution: smustgrave commentedLooks like it may be related to https://www.drupal.org/project/drupal/issues/3055287#comment-13288038. I tried the patch and was able to get the index to run but still doesn't look like it's working. The view I was using it on won't order by title.
Comment #3
generalredneckI'll give it a shot. I'm pretty sure I'm running PHP 7.3 on my automated tests though... though I suspect based on your error message that this is on "install" or on "reindexing". Can you confirm?
Comment #4
smustgrave CreditAttribution: smustgrave commentedThat is correct. The error was thrown when I tried to reindex. Added the patch from #2 and the index then would run. I was seeing the settings in my view where I was trying to sort by title. But the index was only picking up users it seemed.
Comment #5
generalredneckSo looking into #3055287: BatchStorage fails to serialize/deserialize input batch object with FormState, I'm not sure I can fix that particular issue.
That said, I'm going to change the title and description of this issue to match the 2nd issue you found...
I have confirmed this as the case. I'll see what I can do here.
Comment #7
generalredneckStill new to the whole pull request workflow on D.O... But here's a fix ready for review. You can add it to your project byt checking out the branch or you applying this patch https://git.drupalcode.org/project/views_natural_sort/-/merge_requests/1...
From my tests this fixes the issue and may require a new release.
Comment #8
smustgrave CreditAttribution: smustgrave commentedTesting now. I still needed the patch from ttps://www.drupal.org/project/drupal/issues/3055287#comment-13288038 to build the index. Looks like it's building though. Of a site with roughly 10,000 pages though it seems to be indexing over 142,000 records. Not sure if that's a concern.
Comment #10
generalredneck\
Yes. The patch you are describing is nothing I can personally fix in Views Natural Sort as it is a problem with Drupal Core and PHP >=7.3.
This is likely expected because Views Natural Sort doesn't just index "Pages" as noted in your original bug report. Since there are some user, custom block content, and comment fields that also match the criteria to be naturally sorted, they are indexed as well. We can open another issue to "limit" what gets indexed as that's a feature that will be coming soon. It's already a part of the D7 implementation.