Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fulltextsearch:index always scans all files even if index is already available #767

Closed
jensgoe opened this issue Aug 20, 2023 · 5 comments
Closed

Comments

@jensgoe
Copy link

jensgoe commented Aug 20, 2023

I spent some time to debug this issue. The problem must something have to do with the changes for "default collection is local".

The database rows in table "oc_fulltextsearch_index" are stored with an empty string for the collection column. The function getIndex() in "lib/Db/IndexesRequest.php" is filtering with value "local" for the collection column. Thats why the check, if a file is already in the index always fails.

@jensgoe
Copy link
Author

jensgoe commented Aug 20, 2023

similar issue might be #723

@XueSheng-GIT
Copy link

@jensgoe can you add some steps how to reproduce? Maybe also how you did reset your index.

@jensgoe
Copy link
Author

jensgoe commented Sep 22, 2023

It was quite easy to reproduce it:

  1. call php occ fulltextsearch:index
  2. wait until it is finished
  3. call php occ fulltextsearch:index again

expected: skip already indexed files
actual: all files are indexed again, even if nothing has changed.

i fixed it locally for me by modifying file ./apps/fulltextsearch/lib/Model/Index.php.
I initialized the private field collection with "local" and ensured that it stays the value local if an empty value is set:

*** 55,61 ****
        /** @var string */
        private $documentId;

!       private string $collection = '';

        /** @var string */
        private $source = '';
--- 55,61 ----
        /** @var string */
        private $documentId;

!       private string $collection = CollectionService::LOCAL;

        /** @var string */
        private $source = '';
***************
*** 89,95 ****
        public function __construct(string $providerId, string $documentId, string $collection = '') {
                $this->providerId = $providerId;
                $this->documentId = $documentId;
!               $this->collection = $collection;
        }


--- 89,95 ----
        public function __construct(string $providerId, string $documentId, string $collection = '') {
                $this->providerId = $providerId;
                $this->documentId = $documentId;
!               $this->collection = ($collection === '') ? CollectionService::LOCAL : $collection;
        }


***************
*** 152,158 ****
         * @return Index
         */
        public function setCollection(string $collection): self {
!               $this->collection = $collection;

                return $this;
        }
--- 152,158 ----
         * @return Index
         */
        public function setCollection(string $collection): self {
!               $this->collection = ($collection === '') ? CollectionService::LOCAL : $collection;

                return $this;
        }

sorry for the bad diff.

The last days some commits already changed that. It might be fixed with commit 0021dc7

@XueSheng-GIT
Copy link

The last days some commits already changed that. It might be fixed with commit 0021dc7

@jensgoe did check the latest release? The changes you mentioned are included.

@jensgoe
Copy link
Author

jensgoe commented Sep 30, 2023

tested with 27.0.2 and it worked. Thanks. Closing this issue

@jensgoe jensgoe closed this as completed Sep 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants