简体   繁体   中英

MariaDB 10.0 with SphinxSE

I have a question about integrating Sphinx with MariaDB 10.0. The db comes packaged with the SphinxSE storage engine, but I'm having trouble finding detailed information about how to set this up. Consider the following scenario:

I have a book-selling app using a database with the following tables: "Book", "Listing", and "School". A "listing" contains a relationship to a single book and a single school. A "book" contains several columns, most importantly "title" and "author". I would like to perform full-text searches on the "Book" table using Sphinx, and a typical query might go something like this (in pseudo-SQL): "Find all books whose title contains the string 'Harry P' for which a current listing exists at Harvard University".

According to MariaDB's article : "you need to create a special ENGINE=SPHINX 'search table', and then SELECT from it with full text query..." - so does this mean that Sphinx cannot access/index my existing MariaDB tables at all? Must I recreate my "Book" table as a SphinxSE table? If this is the case, how do I specify relationships between this table and my other non-Sphinx tables (Listing, School, etc)? The above article gives a very simple JOIN example, but I'm still confused. If all "books" are stored in a Sphinx table, can MariaDB access this table for different types of queries (where a full-text search is not needed)?

As a related question, what would be a good way to enable Sphinx to index both the Title and the Author of the books? The app will always specify which field is being queried.

Any help would be greatly appreciated, because hours of searching and reading has still left me mostly in the dark on this topic.

The SphinxSE engine is NOT a real engine. All it does is serve a 'proxy' to a underlying Sphinx daemon. It runs the query against sphinx engine, then presents the 'results' as a FAKE table, so that mysql can then join it back with the original table(s).

Basically a convenience method to get sphinx results and the apprirate data in one query (with mysql doing the hard work of doing the 'JOIN')

... so before "worrying" about sphinxSE. You need to figure out a normal Sphinx index, that you can run queries against. ie create an index to be able to run that query. Normally the sphinx query will just give you a list of ids.

So play with getting sphinx setup independantly (without SphinxSE or MariaDB) - create an index, and run some queries against it. Get that working first.

Only once you have the index working (and you understand the concepts) - come back and work out how to set it up with SphinxSE.

There are plenty of articles on getting sphinx working https://www.google.com/search?q=sphinx+search+getting+started

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM