Hi
I am building an addon for plone5. I'd like to add a custom search box to a browserview . The input text should be searched in fields(like title, description) of a content type. How to perform such querying in plone? Any pointers would be helpful
pbauer
(Philip Bauer)
July 26, 2017, 12:42pm
2
You could use collective.portlet.collectionfilter. It is also mentioned here: https://training.plone.org/5/mastering_plone/custom_search.html
pigeonflight
(David Bain (Will Theme Plone Sites))
July 26, 2017, 7:48pm
3
I did this recently using patternslib and reusing Plone's builtin search.
I've linked to the spot in this video where this is demonstrated.
They use a custom browser view but you can use Plone's @@search view.
Also look at the documentation for pat-inject http://patternslib.com/inject/
1 Like
pigeonflight
(David Bain (Will Theme Plone Sites))
July 27, 2017, 12:52pm
4
You can do this really quickly with rapido.
Here's a snippet that you can use as a good starting point.
README.rst
Setup
--------------
- This requires Plone 5.1 with plone.patternslib and rapido.plone installed
The files should be located in your theme under the rapido folder of your theme. The tree might look like this::
rapido
views
blocks
searchdemo.pt
This file has been truncated. show original
searchdemo.pt
<form action="@@search#search-results-wrapper" data-pat-inject="target: #search-results" class="pat-inject pat-autosubmit">
<input type="text" name="SearchableText" />
</form>
<div id="search-results">
hello
</div>
searchdemo.yaml
view:
id: searchdemo
with_theme: true
2 Likes