Upon investigation of a batch reindex, it was discovered that user data is the only data that seems to be indexed.
Steps to reproduce

  1. Create 3 nodes test1, test2, test10
  2. create 3 users test1,test2, test10
  3. enable views natural sort
  4. 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.

Command icon 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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

smustgrave created an issue. See original summary.

smustgrave’s picture

Looks 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.

generalredneck’s picture

Status: Active » Postponed (maintainer needs more info)

I'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?

smustgrave’s picture

That 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.

generalredneck’s picture

Title: Doesn't work with PHP 7.3 » Reindexing doesn't index node titles
Issue summary: View changes
Related issues: +#3055287: BatchStorage fails to serialize/deserialize input batch object with FormState

So 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 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.

I have confirmed this as the case. I'll see what I can do here.

generalredneck’s picture

Status: Postponed (maintainer needs more info) » Needs review

Still 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.

smustgrave’s picture

Testing 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.

  • generalredneck committed 224b2c2 on 8.x-2.x
    Issue #3185945 by smustgrave, generalredneck: Reindexing doesn't index...
generalredneck’s picture

Status: Needs review » Fixed

Testing now. I still needed the patch from ttps://www.drupal.org/project/drupal/issues/3055287#comment-13288038 to build the index.

\
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.

Of a site with roughly 10,000 pages though it seems to be indexing over 142,000 records.

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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.