[xquery-talk] search mechanism
Peter.Mueller10 at gmx.de
Thu Apr 6 13:09:57 PDT 2006
I am quite new to XQuery and could need some expert opinion.
I am trying to implement a search mechanism like those in library systems
where you can combine several queries with AND/OR-operators (for instance
search for search_term1 in the titles AND search_term2 in the abstracts and
so on ...
So far I have been performing the following steps:
1) done several queries separately like the following:
for $doc in //text/abstract
2) stored the IDs of the documents in Java-Hashtables (one for each query)
3) combined these ID-Hashtables according to the operators set by the users
4) then searched the documents that belong to the accumulated IDs with the
for $doc in //text[@id='id1'] | //text[@id='id2'] ...
order by fn:year-from-date($doc//date)
descending return $doc
This does work but seems rather complicated to me!
What do you think?
I would think that it should be possible (and better?) to do this entirely
in one single XQuery ...?
Second, I only want to show the first 10 hits to the user and generate links
( [11-20] [21-30] etc.) to allow accessing the rest.
So far I am thinking about storing the start- and stop-position plus all (up
to 4 queries) that have led to the results with each link.
Again, this seems rather complicated to me, but I can't think of anything
else. Do you have any suggestions for me?
Thanks for every hint!
Analog-/ISDN-Nutzer sparen mit GMX SmartSurfer bis zu 70%!
Kostenlos downloaden: http://www.gmx.net/de/go/smartsurfer
More information about the talk