LostKobrakai Posted November 24, 2014 Share Posted November 24, 2014 I've build an address fieldtype based on the eventfieldtype module. Now I wanted to use "*=" or "%=" in a selector and got an error, that these aren't supported by the fieldtype. But I need them to work for a search. What do I have to do to get these operators zu work? The subfields I need are only plain text. Link to comment Share on other sites More sharing options...
LostKobrakai Posted November 25, 2014 Author Share Posted November 25, 2014 Nobody any insights? I need this to work by thursday evening. Push Link to comment Share on other sites More sharing options...
judetomi Posted November 26, 2014 Share Posted November 26, 2014 You could try this solution. Put this to the getMatchQuery function. if(wire('db')->isOperator($operator)) { return parent::getMatchQuery($query, $table, $subfield, $operator, $value); } else { $ft = new DatabaseQuerySelectFulltext($query); $ft->match($table, $subfield, $operator, $value); return $query; } 3 Link to comment Share on other sites More sharing options...
LostKobrakai Posted November 26, 2014 Author Share Posted November 26, 2014 Thanks, now at least %= is working, so my search is usable. Using *= gives me this error. Fatal error: Exception: SQLSTATE[HY000]: General error: Can't find FULLTEXT index matching the column list It's sad, that this part is left out in the FieldtypeEvent as it should kinda like a blueprint to custom fieldtypes. Link to comment Share on other sites More sharing options...
judetomi Posted November 26, 2014 Share Posted November 26, 2014 You have to change keys to FULLTEXT in getDatabaseSchema like this $schema['keys']['data'] = 'FULLTEXT KEY data (data)'; 3 Link to comment Share on other sites More sharing options...
kongondo Posted November 26, 2014 Share Posted November 26, 2014 This folder is full of examples /wire/modules/Fieldtype/ Link to comment Share on other sites More sharing options...
apeisa Posted November 26, 2014 Share Posted November 26, 2014 Kongondo, unfortunately there is not that much examples for more complex fieldtypes. Link to comment Share on other sites More sharing options...
LostKobrakai Posted November 26, 2014 Author Share Posted November 26, 2014 You have to change keys to FULLTEXT in getDatabaseSchema like this … I wouldn't mind if I didn't had it that way already. That's why I stumbled with it, because everything seemed like in all those other modules. $schema['keys']['data'] = 'FULLTEXT KEY data(data)'; $schema['keys']['street'] = 'FULLTEXT KEY street(street)'; $schema['keys']['number'] = 'FULLTEXT KEY number(number)'; $schema['keys']['postal'] = 'FULLTEXT KEY postal(postal)'; $schema['keys']['city'] = 'FULLTEXT KEY city(city)'; $schema['keys']['title'] = 'KEY title(title)'; $schema['keys']['country'] = 'FULLTEXT KEY country(country)'; Edit: Yeah, somehow my mind must have been empty while I wrote this. "lastname" and "province" missing. Edit2: Can someone explain, a little further what these keywords actually do in the database? In a quick google search I found, that also the order of columns can play a role for indexes, but I'm not that fluid in database stuff. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now