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

Autocomplete Fulltext query broken for Owners #28

Closed
knoxguru opened this issue Nov 3, 2013 · 6 comments
Closed

Autocomplete Fulltext query broken for Owners #28

knoxguru opened this issue Nov 3, 2013 · 6 comments

Comments

@knoxguru
Copy link

knoxguru commented Nov 3, 2013

When attempting to search using the dropdown for users when adding a contact or a contact group the autocomplete query returns a 500:

The query it runs produces:
#1191 - Can't find FULLTEXT index matching the column list

I've confirmed that it is the query and not the script. I can get the query to run by removing the MATCH() in the SELECT but don't want to do that in the code base.

The full query and params below:

An exception occurred while executing 'SELECT DISTINCT MATCH(o0_.value) AGAINST (? ) AS sclr0, o1_.id AS id1, o1_.entity AS entity2, o1_.alias AS alias3, o1_.record_id AS record_id4, o1_.title AS title5, o1_.changed AS changed6, o1_.created_at AS created_at7, o1_.updated_at AS updated_at8, o2_.id AS id9, o2_.field AS field10, o2_.value AS value11, o2_.item_id AS item_id12 FROM oro_search_item o1_ LEFT JOIN oro_search_index_text o2_ ON o1_.id = o2_.item_id AND (o2_.field = ?) LEFT JOIN oro_search_index_text o0_ ON o1_.id = o0_.item_id LEFT JOIN oro_search_index_integer o3_ ON o1_.id = o3_.item_id LEFT JOIN oro_search_index_decimal o4_ ON o1_.id = o4_.item_id LEFT JOIN oro_search_index_datetime o5_ ON o1_.id = o5_.item_id WHERE o1_.alias IN ('oro_user') AND (((MATCH(o0_.value) AGAINST (? IN BOOLEAN MODE ) > 0 AND o0_.field = ?) OR o0_.value LIKE ?)) ORDER BY sclr0 DESC LIMIT 11' with params ["d", "all_text", "d*", "all_text", "d%"]:

@knoxguru
Copy link
Author

knoxguru commented Nov 3, 2013

If anyone is interested in fixing it themselves here is the diff ( just two lines need to be edited):
File: Oro/Bundle/SearchBundle/Engine/Orm/PdoMysql.php

Change Line 165:
"MATCH_AGAINST(textField.value, :$rawValueParameter) AS rankField"
To:
"textField.value AS rankField"

Change line 167:
)->setParameter($rawValueParameter, $fieldValue)->orderBy('rankField', 'DESC');
To:
)->orderBy('rankField', 'DESC');

I would assume you could override function createMatchAgainstWordsExpr as well.

@yurio
Copy link
Contributor

yurio commented Nov 4, 2013

Good day.
Error "1191 - Can't find FULLTEXT index matching the column list" is telling that You don't enabled MyISAM fulltext index.
Try to run php app/console oro:seach:create-index command. It will create fulltext index.

@knoxguru
Copy link
Author

knoxguru commented Nov 4, 2013

I used the setup wizard instead of the install.sh script. Does this mean the wizard didn't run this step?

@yurio
Copy link
Contributor

yurio commented Nov 5, 2013

To install from the console, use php app/console oro:install command. install.sh script will be removed.

@knoxguru
Copy link
Author

knoxguru commented Nov 5, 2013

Thanks, So the problem is that the wizard doesn't create the fulltext indexes? app/console oro:search:create-index fixed the issue without my hack above.

I'll use command like oro:install going forward. Thanks.

@dxops
Copy link
Member

dxops commented May 27, 2014

Hi, @knoxguru !

This issue was fixed, and I think we can close it. Thanks!

rgrebenchuk pushed a commit that referenced this issue Mar 14, 2017
* BAP-13241: Mysql error when searching special chars
- clearing all non-alphanumeric characters from string query for full text search in pgsql and mysql
- disabled dbIsolation for Search Bundle Fumctional Tests due to fulltext index being built only for commited data

* BAP-13241: Mysql error when searching special chars
- handled case when users search only for special chars wich then gets filtered to empty string
- added aditional test requests
- added necessary comments

* BAP-13241: Mysql error when searching special chars
- moved specific testCase to search bundle

* BAP-13241: Mysql error when searching special chars
- removed tear down method

* BAP-13241: Mysql error when searching special chars
-mark test two test cases to be check only when using orm search engine

* BAP-13241: Mysql error when searching special chars
- refactoring after code review
- for pqSQL clearing strings only for all_text_ fields
- marked deprecated methods
- updated docs

* BAP-13241: Mysql error when searching special chars
- changed method visibility

* BAP-13241: Mysql error when searching special chars
- moved field name check to BaseDriver

* BAP-13241: Mysql error when searching special chars
- altered test cases 27 and 28 so result item order can be predicted

* BAP-13241: Mysql error when searching special chars
- skipping test #28 for ES

* BAP-13241: Mysql error when searching special chars
- added explanation comment for clearString method in Oro\Bundle\SearchBundle\Query\Query
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants