XQuery backend for a search is written
Posted by mholmes on 12 Nov 2010 in Activity log
Implementing a simple search engine, this is what I've done so far:
- In collection.xconf, added this section, to enable fulltext searching of the specified nodes:
<lucene> <text qname="tei:entry"></text> <text qname="tei:pron"></text> <text qname="tei:def"></text> <text qname="tei:hyph"></text> <text qname="tei:note"></text> </lucene> - Confirmed that simple queries like this now work:
declare default element namespace "http://www.tei-c.org/ns/1.0"; declare namespace tei="http://www.tei-c.org/ns/1.0"; declare namespace ft="http://exist-db.org/xquery/lucene"; for $e in collection('/db/moses')//tei:entry[ft:query(., 'visiting')] return $e - Added a pipeline for outputting the XML results of the search, and confirmed the results are showing up with appropriate exist:match tags.
- Created a basic pipeline for the eventual XHTML output.
Next steps:
- Create a search.xsl file, which will render a search form.
- Decide whether we should retrieve results into the existing page, or whether we should reload the page anew and echo out the search parameters.
- Decide on how to render the results (full items, I think).
- Test the Lucene query syntax, and evaluate it against the flexibility of our own Java library. We could rewrite the Java library to support the Lucence ft: searching, or if it provides enough power on its own, adopt it in preference to ours.