2007/1/25, Magnus Bergman <<a href="mailto:magnus.bergman@observer.net">magnus.bergman@observer.net</a>>:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Thu, 25 Jan 2007 09:44:53 +0100<br>"Mikkel Kamstrup Erlandsen" <<a href="mailto:mikkel.kamstrup@gmail.com">mikkel.kamstrup@gmail.com</a>> wrote:<br><br>> 2007/1/24, Magnus Bergman <<a href="mailto:magnus.bergman@observer.net">
magnus.bergman@observer.net</a>>:<br>> ><br>> > On Sun, 21 Jan 2007 01:41:47 +0100<br>> > "Mikkel Kamstrup Erlandsen" <<a href="mailto:mikkel.kamstrup@gmail.com">mikkel.kamstrup@gmail.com
</a>> wrote:<br>> ><br>> > > Here's an actual proposal for unifying the simple and live apis.<br>> > > I'm not saying that we really really should do this, just that it<br>> > > is doable, and it still allows for quite simple use cases (see
<br>> > > below). It is actually very much in spirit with Magnus' very<br>> > > first proposal a while back. Praise late insight :-)<br>> > ><br>> > > == Unified API Proposal ==<br>
> > ><br>> > > NewSession (out s session)<br>> > > *<br>> > ><br>> > > SetProperty (in s session, in s prop, in s val)<br>> > > * Set a property on the session. Prominent ones are
<br>> > > - live : whether or not to be in live mode. Default false.<br>> > > - hit.properties : semi colon separated list of field names.<br>> > > Default "uri".<br>> ><br>
> > Does the (potentially) expensive properties need to be included in<br>> > hit.properties, or are they considered special?<br>><br>><br>><br>> In the updated proposal the expensive properties are requested via the
<br>> GetHitData method. Here you don't have to list the desired properties<br>> in hit.properties.<br><br>OK. You mentioned cases there it can be relevant for the search engine<br>to know which hit properties will be requested before the search starts
<br>(which is the reason why they are set with hit.properties). Isn't it<br>possible that the same goes for the expensive properties (that less<br>resources could be used it was known in advance that the expensive<br>
property would never be requested)? (Not that I care much of this<br>detail, I just thought I should mention in.)</blockquote><div><br><br>Yeah, we could include a "hit.properties.extended" property which was not included in the result set, but was a hint/warning to the search engine about the client being likely to request these attributes via GetHitData. I don't think it should be mandatory though, just an optional hint.
<br> </div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">> ><br>> > > GetProperty (in s session, in s prop)<br>> > > *
<br>> > ><br>> > > CloseSession (in s session)<br>> > > * Close the session and all child searches<br>> > ><br>> > > Search (in s session, in s query_xml, out s search)<br>> > > * Start a new search from a query
<br>> > ><br>> > > CountHits (in s search, out i count)<br>> > > * Returns the current number of found hits. If live=false this<br>> > > call blocks until the index has been fully searched.
<br>> > ><br>> > > GetHits (in s search, in i num, out aav hits)<br>> > > * Return num hits. If live=false this call blocks until there is<br>> > > num hits available or the index has been fully searched.
<br>> > > The client should keep track of each hit's serial number if it<br>> > > want to use GetHitData later.<br>> > ><br>> > > GetHitData (in s search, in ai hit_ids, in as properties, out aav
<br>> > > hit_data)<br>> > > * Get hit metadata. Intended for snippets or modified hits.<br>> > > hit_ids are serial numbers as obtained from GetHits.<br>> ><br>> > The GetHits/GetsHitsData functions was a quite elegant solution, I
<br>> > must say. But one thing isn't clear to me. Can any property be<br>> > requested with GetHitsData (restarting the search if needed)? Or<br>> > just those that are included in hit.properties? Or perhaps those
<br>> > that are either expensive *or* included in hit.properties?<br>><br>><br>> Any property can be requested via GetHitData. That was the idea at<br>> least. I documented this on<br>> <a href="http://wiki.freedesktop.org/wiki/WasabiSearchLive">
http://wiki.freedesktop.org/wiki/WasabiSearchLive</a> now.<br>><br>> Perhaps the "current hit_id" (the implicit offset used in GetHits)<br>> could<br>> > be a property of the search?<br>><br>>
<br>> Well, then the Search object/handle would need properties anyway.<br>> Would it not be easier to put such counting functionality in a<br>> language/platform binding? It can easily be calculated by the client
<br>> anyway.<br><br>Yes, this is also just a small detail. If it's considered needed it can<br>easily be added later anyway.<br><br>> > > CloseSearch (in s search)<br>> > > * Close and free a search.
<br>> > ><br>> > > SIGNAL HitsAdded (in i count)<br>> > > SIGNAL HitsRemoved (in ai hit_ids)<br>> > > SIGNAL HitsModified (in ai hit_ids)<br>> ><br>> > All in all I'm very happy with this proposal.
<br>> ><br>><br>> Ok, good. I updated the live proposal with most of your feedback.<br><br>Another thing I thought of: The search function of the simple API<br>(possibly) took a "simple end user QL" string instead of XML. Has this
<br>idea been dropped or just forgotten? Personally I'm in favor of<br>dropping it and create XML from "simple end user QL" on the client<br>side, possibly using a library.<br></blockquote></div><br><br>The xml language proposed at
<a href="http://wiki.freedesktop.org/wiki/WasabiQueryLanguage">http://wiki.freedesktop.org/wiki/WasabiQueryLanguage</a> allows for embedding of user queries. Here's a copy-paste of the example from the page:<br><br><pre>
<request><br> <userQuery><br> type:music hendrix<br> </userQuery><br></request></pre><br>I think this should be enough. It would be trivial for language bindings to provide a helper method UserSearch("type:music hendrix") wrapping the string in the appropriate xml,
<br><br><br>Cheers,<br>Mikkel<br>