[Silva-general] "silva find" in a code source?

Kit BLAKE kitblake at infrae.com
Wed Apr 29 14:02:40 CEST 2009


If all you want to do is filter out duplicates it's probably doable  
with view code. But not if you want more complex operations. You might  
look at the rendering code:
https://svn.infrae.com/SilvaFind/trunk/SilvaFind_templates/silvafindview.pt?revision=33349&view=markup

The guy who wrote SilvaFind will be in friday and he should be able to  
give you better advice on that level.

Kit


On 29 Apr 2009, at 13:45, Raoul Schaffner wrote:

> hi kit,
>
> thank you for the hint.
>
> i've already programmed my custom search form to interact with
> silva find for another project. however, this still uses silva
> find to generate the search result page.
>
> i need some sort of api access to deal with the found objects,
> rather than a "view" of the search results.
>
> the result should be similar to get_breadcrumbs or get_public_tree,
> a list with silva objects.
>
> i'm not sure if i understand you correctly, but you suggest
> processing the normal "view" output from silva find in a python
> script. how would i accomplish that?
>
>
> thanks again,
> raoul.
>
>
>> If you install the documentation you'll find a Find (heh :)) and
>> search field embedded in a template. Or go to:
>> http://www.infrae.com/products/silva/docs
>>
>> The code is in the layout_macro. You should be able to copy it into a
>> code source page template without much trouble. To save you digging,
>> this is the code, including a javascripted hint in the field:
>>
>> <div class="documentation_search"
>>   tal:condition="python: hasattr(here.get_root().service_views,
>> 'SilvaFind')">
>>   <form action="" name="searchform"
>>     tal:attributes="action python:here.search.absolute_url()"
>>     tal:define="docroot
>> python:'%s/'%'/'.join(here.search.getPhysicalPath()[:-1])">
>>         <input name="fulltext" id="fulltext" value="" size="19"
>> class="store" type="text"
>>           tal:attributes="value
>> python:unicode(request.form.get('fulltext', 'Search documentation'),
>> 'utf8')"
>>         onkeyup="if (event.keyCode == 13){this.form.submit()};"
>>         onclick="if (this.value == 'Search documentation')
>> {this.value=''};">
>>         <!--<input class="button searchform-submit" value="Search"
>> accesskey="s" title="access key: alt-s" type="submit">-->
>>         <input name="search_submit" type="hidden" value="1"/>
>>         <input name="path" type="hidden" tal:attributes="value
>> docroot"/>
>>   </form>
>> <script  
>> language="javascript">document.searchform.fulltext.select();</
>> script>
>> </div>
>>
>> For the post-search filtering, you probably want to send that through
>> a Python script that then returns the result.
>>
>> Kit
>




More information about the silva-general mailing list