-
Notifications
You must be signed in to change notification settings - Fork 870
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
Index not used with OR/AND condition combination #8693
Comments
I tried this on v3.0.6 as well, but I am not 100% sure how to read the query plans? But if the index is supposed to be listed when used then I can't get it to use a fulltext index in v3 at all? select * from v where (prop1 containstext 'sometext' or prop2 containstext 'sometext') and prop3 = 'containstext'
|
Hi @creisle V 2.2 query engine has significant limitations on query optimization, this is why we re-wrote the engine. I doubt we can fix it. In v 3.0 it's supposed to work though, the fact that it doesn't is probably a bug (the CONTAINSTEXT is an old operator, most users tend to use LUCENE instead, so probably we just missed a little piece in the implementation). I'll check it ASAP and let you know Thanks Luigi |
@luigidellaquila did you have any luck looking at this is v3? |
Hi @creisle Sorry, not yet, I'll try to check it today Thanks Luigi |
Sorry to bug you again, any luck here? |
@luigidellaquila any luck here? this is blocking me upgrading to v3. I looked into swapping to lucene indices but they are overkill for my use-case and hang so I cannot delete that database with them (related to 8471) so this seems like the only option atm |
Hi @creisle Sorry, not yet :( I hope I'll find some time to fix it this week Thanks Luigi |
Hi @creisle I have good news for you, I just pushed a fix for this problem. The fix will be released with v 3.0.19, the snapshot will be available in a few minutes Anyway, in general I strongly suggest you to use Lucene indexes instead of the legacy FULLTEXT indexes, that are much more stable Thanks Luigi |
@luigidellaquila thank you so much! I will likely revisit swapping to the lucene indexes later once #8471 is resolved |
@luigidellaquila I just tried this in v3.0.20 and it still does not appear to use the index select * from vocabulary where name containstext 'expr'
|
Hi @creisle I just tested it as follows:
and the result:
Am I missing something? Thanks Luigi |
@luigidellaquila I was using the fulltext hash index previously create index vocabulary.name on vocabulary (name) FULLTEXT_HASH_INDEX when you replace creating the index with the above instead, the index is not used in the query plan
|
Is FULLTEXT_HASH_INDEX no longer supported in v3? I could use the SBTREE option instead? should it throw an error? |
Hi @creisle OK, it makes sense, I think it just needs a little fix. FULLTEXT_HASH_INDEX is still there, even though it is not recommended (same as other legacy FULLTEXT implementations). Checking it now, I'll keep you updated Thanks Luigi |
Hi @creisle I pushed a new fix, now also fulltext hash indexes work fine Thanks Luigi |
Related-to: orientechnologies/orientdb#8693 Related-to: KBDEV-178,KBDEV-343
OrientDB Version: 2.2.37
Java Version:
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
OS: centos7
Expected behavior
Expected the index to be used
Actual behavior
The index was not used
Steps to reproduce
Create the test conditions with randomly named property prop1, prop2, prop3
Create full-text indexes on prop1 and prop2
Now attempt to query (explain)
This works as expected and the index is used
However if these conditions are then surrounded in parentheses and the conditions following it use an AND this will fail to use the index
see explain below
The text was updated successfully, but these errors were encountered: