I have a XML document which contains around 4000 entries of data. The data will be used in a PHP environment and is needed for a Web-App. I thought about using “sphinx” ( http://sphinxsearch.com/docs/2.0.1/xmlpipe2.html ) for indexing the data but was wondering, what other, maybe better options are out there.
Thanks in advance,
Andy
EDIT: I don’t want to write an importer script which loads the XML file into a e.g. MySQL-DB. It should be something like: Load the file into this tool/program/whatever and then it should be searchable from PHP.
If you have 4000 entry’s and you want only one, the whole file is read until it finds your entry. That can be a long time. You might want to use a Database like MySQL.
If you want to make your XML-file search able, you’ll end up with one of those two options:
Array or something that can be
quickly searched (will cause a lot
of memory on every call to the
PHP-Script)
file, searching for your desired
entry (will be even slower then
number one because you’ll have to
see if it’s your desired entry every
time before you can continue to
search).
For performance-reasons, neither of those options are really acceptable. It gets even more tricky if you want users to edit your XML-file, because they are not multi-thread save (like Databases).
If you want a good performance for your search, you’ll want to use a Database. It’s just as easy as that.
Yet another thing would be letting the users machine parse the XML-File (using JavaScript) and get something like a id for the desired article (which is then opened from your Server). But depending of your XML-file’s size and the power of the user’s machine, the Browser might interrupt and cancel the script.