php - MySQL 5.7.9 fulltext research in multiple tables with Sphinx on WAMP -


i have research in multiple mysql tables internship. in fact, web phone directory. have form text input enter research. tried use match/against syntax appears wrong. query 1 :

select u_id, 'users' users   match ([columns want search in]) against ([the text inside search field])  union  select s_id, 'service' service  match ([columns want search in]) against ([the text inside search field]) 

this problem following : type of search, must send variable in many match can't have relevant result (because of multiple against elements). perfect solution replace 'union' 'inter' easy. don't know if usefull, use pdo send query php

i tried search solutions couldn't find 1 me :

https://dev.mysql.com/doc/refman/5.5/en/fulltext-search.html
using full-text search in sql server 2008 across multiple tables, columns
mysql fulltext search on multiple tables different fields

then tried use sphinx documentation complicated me , couldn't understand (http://sphinxsearch.com/docs/current.html).

can me find query need or can give me link of clear , simple sphinx tutorial on windows (i have read ibm one) ?

edit :

i wanted illustrate problem set theory (inter mean intersection). example, when type "john accounting department" in form input, want display users named john, if belong accounting department. actual search, have id of departments named : "john" or "accounting" or "department" , id people named "john" or accounting" or department". that's actual problem.

i think materialized view easiest way solve in mysql.

they not strictly feature of mysql (ie mysql cant maintain view automatically, not view) normal table, happens copy of other table(s) data.

can created quite easily...

create table my_search_view (fulltext(u_name,s_name))      select u_id, u_name, s_id, s_name     user     inner join service using (s_id); 

(if update source tables, delete table, , recreate it! although can use triggers if want more dynamic solution, depending size of data possibly not worth effort)

now can run query against table (it has full-text index)

select * my_search_view match (u_name,s_name) against ('john accounting department') 

Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -