On Sunday, May 8, 2016 at 9:55:10 AM UTC+10, Dev wrote: > > On Sun, May 8, 2016 at 12:35 AM, Mike Bayer <[email protected]> > wrote: > >> >> >> On Saturday, May 7, 2016, Dev Mukherjee <[email protected]> wrote: >> >>> >>>> >>>> >>> If I create the full text and include multiple fields in the index >>> >>> CREATE FULLTEXT INDEX `keyword_search` ON >>> customer(name,physical_address_street,physical_address_suburb, >>> physical_address_state,physical_address_post_code); >>> >>> I can only execute a search with the same set of fields >>> >>> SELECT * FROM customer WHERE >>> >>> MATCH(name,physical_address_street,physical_address_suburb,physical_address_state, >>> physical_address_post_code) AGAINST ("+Anomaly" IN BOOLEAN MODE); >>> >>> If I try this in SQLAlchemy >>> >>> session.query(Customer).filter(Customer.name.match("+Anomaly"), >>> Customer.physical_address_street.match("+Anomaly"),Customer.physical_address_suburb.match("+Anomaly"),Customer.physical_address_state.match("+Anomaly"),Customer.physical_address_post_code.match("+Anomaly")).all() >>> >>> MySQL complains about no matching column list for Full text search. >>> >>> Is is possible to express multiple fields in the match operator? Or >>> should I not be creating a full text index amongst multiple fields? >>> >> >> >> Right that *is* the use case that the stack overflow answer is meant for. >> I can accept pull requests that add a new mysql.match() object for this >> purpose. But it might be nice if it integrates with the FULLTEXT DDL part >> of it as well. This is all very simple to implement it's just coming up >> with a great API that supports all the edge cases that has to be done >> carefully. >> >> > > I should have been clearer in my response :-) I was double checking if the > existing operator supported that edge case. We will fork the repo and > implement the functions (along with DDL support). > > Follow up to my own response and intent to implement this. Meng Zhuo already has a project that implements this function https://github.com/mengzhuo/sqlalchemy-fulltext-search
Working through this https://github.com/mengzhuo/sqlalchemy-fulltext-search/issues/9 but other than that it works really well. Also it's possibly best served to stay as an add-on as opposed to make it back into SQLAlchemy. Mike is probably a better judge of that :-) -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
