-
-
Notifications
You must be signed in to change notification settings - Fork 237
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
FullText Search in laravel-oci8 #800
base: 10.x
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few notes and maybe add an orWhereFullText test as well.
Added!! Thanks for remember! |
Relevant issues have been addressed... Now it is possible to utilize the "orWhereFullText()" and the option "labelSearch" not need passing in the "$options" of the "whereFullText()" method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, tested locally and everything seems to work as expected. Looks good to me.
Everything looks correct except for multiple column fullText: $table->fullText(['name', 'username', 'email'], 'users_fulltext_search'); ErrorError Code : 29851
Error Message : ORA-29851: cannot build a domain index on more than one column
Position : 51
Statement : create index users_fulltext_search on users (name, username, email) indextype is ctxsys.context parameters ('sync(on commit)')
Bindings : []
(Connection: oracle, SQL: create index users_fulltext_search on users (name, username, email) indextype is ctxsys.context parameters ('sync(on commit)')) Tested on |
@@ -487,6 +487,17 @@ public function testAddingIndex() | |||
$this->assertEquals('create index baz on users ( foo, bar )', $statements[0]); | |||
} | |||
|
|||
public function testAddingFullTextIndex() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SQL generated is as expected but doesn't work when executed on actual DB migration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
omg.. multiple columns index in oracle is implemented with ctx_ddl preferences 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, ctx_ddl is something new to me 😅. Do I need some special setup for this work?
Will also try to research this. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is new for me too 😅, but i researched about this, is simple to use.
For create multiple columns index, is necessary execute grant CTX_DDL to owner.
The code create preference "idx" and set configuration for columns "FIRSTNAME" and "LASTNAME", attribuiting in creation of index "firstname_multiple":
BEGIN
ctx_ddl.create_preference('idx', 'MULTI_COLUMN_DATASTORE');
ctx_ddl.set_attribute('idx', 'COLUMNS', 'FIRSTNAME, LASTNAME');
EXECUTE IMMEDIATE 'create index firstname_multiple ON "USERS" ("FIRSTNAME") INDEXTYPE IS CTXSYS.CONTEXT PARAMETERS (''DATASTORE idx SYNC(ON COMMIT)'')';
END;
Is possible search if content contains in column "LASTNAME" by:
SELECT * FROM USERS u WHERE CONTAINS(FIRSTNAME, 'content_lastname') > 0
Summarized implementation of multiple full text index columns in oracle 😎
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed this bug and implemented ctx_ddl preferences to create multi_columns_index oracle feature. In method compileFullText(), i implemented one index to each column, enabling the search of multi column preference. If you have any suggestions, don't hesitate to help me 😅. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @hpacleb, you have a new suggestions? 😁
…nd multiples indexes
@jonas-elias thank you for the updates. We will review it as soon as we can. Ping @hpacleb ^_^ |
Any updates on this? |
Title 😎
Hello, this pull request implements the "whereFullText()" method for laravel/oci8.
Description 🤯
The implementation utilizes the CONTAINS Oracle feature to perform a text search using the ctxsys.context index. To facilitate the creation of the index, a migration method named "fullText(nameColumn)" is included.
Additional notes 🤨
I have made modifications to the "testDropAllTables()" method to incorporate a constraint for secondary tables created by Oracle. This change prevents an error when dropping secondary tables whose parent tables have text reference indexes, and ensures the proper disposal of secondary tables (Oracle's automatic cascade). The relevant column "SECONDARY" is described in the documentation (references 3 and 4).
Running tests 🚀
./vendor/phpunit/phpunit/phpunit --filter=testWhereFullText
./vendor/phpunit/phpunit/phpunit --filter=testOrWhereFullText
References 🖥
Please review the changes, and if everything looks good, consider merging the pull request. Thank you 😁!