Jason,

Here is a possible solution for C2 (don't know which version you are using)
The sorting part is the most difficult part. If it is possible to let the
searchengine sort the results, you should go for this approach. Otherwise
you have to write a transformer which does the sorting, but this won't be
possible without storing the result in an intermediate datastructure, which
you have to sort and which you have to stream into SAX events again
afterwards.
When this is done, you can reuse some transformers in C2: FilterTransformer,
WriteDOMSessionTransformer and ReadDOMSessionTransformer. See the
documentation for SQLTransformer for more info on these...


Sven



> -----Original Message-----
> From: Jason Smith [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 10, 2001 9:27 PM
> To: '[EMAIL PROTECTED]'
> Subject: Sorting search results in Cocoon
> 
> 
> I'm kind of new at this whole XML/XSP/XSL thing, so if this 
> has a simple
> solution,
> please bear with me.
> 
> Here's the situation: I have a search engine that passes out 
> search results
> as XML
> to anything that can make a HTTP request to it. When it 
> returns the results,
> it looks 
> something like this:
> 
> <searchresults>
>       <result>
>               <name>Result 1</name>
>               <description>This is result 1</description>
>               <href>http://here.com/index.html</href>
>               <score>2.3</score>
>       </result>
> 
>       <result>
>               <name>Result 2</name>
>               <description>This is another result</description>
>               <href>http://there.com/index.html</href>
>               <score>1.2</score>
>       </result>               
> 
>       etc.
> </searchresults>
> 
> 
> The <result> elements can be repeated infinitely depending on how many
> search
> results the engine finds that match search query. <score> is 
> the search
> result's 
> ranking against the search query; the rest of the elements in 
> <result> are 
> self-explanatory. 
> 
> The search engine returns ALL matches at once in one big XML 
> file. There
> could be a dozen search results, 100, or 1.
> 
> How would one go about limiting those results in Cocoon? Say I get 100
> results,
> but I only want to display the top 10 results by score. I'm 
> assuming XSP
> is the answer, but I've been going nuts trying to get this 
> stuff to work.
> I have O'Reilly's "Java and XML" on back-order, so hopefully 
> that can clear
> up my confusion, but until then, anybody got any ideas or 
> some direction
> for me?
> 
> Thanks for any help.
> 
> J
> 
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> 
> To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> For additional commands, e-mail: <[EMAIL PROTECTED]>
> 

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to