[Xapian-discuss] Practical example/explanation using an existing
database
Alexander Lind
malte at webstay.org
Tue Jul 24 04:19:38 BST 2007
Edwin Smulders wrote:
> Hi,
>
> I'm reading up on the usage of Xapian to find out if we can use it for
> Wine's Application Database, and I'm having a bit of trouble seeing
> the general picture. I could use some practical information (through
> words or code) on how to search an existing (mysql) database.
>
> As far as I can tell it can be used with a mysql db, and I read that
> Xapian first makes an index (in it's own database/tables ?)
Yes, its own database.
> and then
> searches through that index. Now a few questions come to mind and I
> couldn't find the answers in the documentation.
>
> Firstly, how exactly does the indexing work in regard to telling
> Xapian what to search through? Do we write an SQL query returning all
> the data we want indexed?
Thats pretty much how I do it myself.
> or maybe do we tell it what tables/columns
> to index (ie. does it generate queries?)
Core Xapian does not come with any such functionality, but Omega (which
is a packaged search engine app that you can get from xapian.org) I
think may have something that can digest a table in a db by itself. Not
sure about this, I don't use Omega, but should be easy to find out.
> And how is the index updated, a regular rescan or an update whenever
> data in our system updates?
If you don't use Omega its up to yourself how you want to maintain the
index, Omega has the functionality to do it for you I think.
Personally I flag entries in the db table when they change, and then I
update them in Xapian in a batch.
>
> The other question that came to mind is, once everything is indexed,
> how is the data returned on a search? This is best explained in an
> example:
> If a user would be entering a a search term and I (the programmer)
> want to search the database, can i specifically tell Xapian to search
> in for example the application names, or the descriptions, or both?
You can achieve this by using prefixes in the index, but would it not be
better to just index terms in application names with more weight, and
terms from descriptions with less weight and search among all terms always?
>
> I hope somebody can clarify this for me, right now it all looks quite
> difficult to implement.
I had a hard time grasping Xapian also in the beginning, the manual is
pretty technical, but the example code provided helped a lot. But the
time it took to learn it was time well invested, Xapian is absolutely
awesome. Fast, stable, and actively developed. And the authors are very
helpful.
Alec
>
>
> Edwin Smulders
>
> _______________________________________________
> Xapian-discuss mailing list
> Xapian-discuss at lists.xapian.org
> http://lists.xapian.org/mailman/listinfo/xapian-discuss
>
More information about the Xapian-discuss
mailing list