plomino / Plomino

Powerful and flexible web-based application builder
33 stars 37 forks source link

Using facetednavigation with Plomino content #808

Closed fulv closed 7 years ago

fulv commented 7 years ago

Has anyone used eea.facetednavigation to build a search page for Plomino documents? I'm thinking of giving it a try unless anyone can give me strong reasons not to do it.

I want a faceted search page just for Plomino documents, not other Plone content. Also, I want only certain kinds of documents to be searchable. I can build custom indexers to be used by faceted nav widgets. The only problem I can think of is that I currently have the setting for "indexing in portal_catalog" turned off, so there are no brains to be returned and I'm not sure if my indexes would do any good. Then I could create custom views for the content area of the faceted nav page.

Thoughts?

fulv commented 7 years ago

I'll answer my own questions:

  1. Works like a charm! Plomino + facetednav = FTW!
  2. In facetednavigation it's super easy to restrict searches just to PlominoDocuments. For example, just create a hidden widget for the portal_type index, select only Plomino: Document and you're done.
  3. With a "TAL Expression" widget, it is also easy to enter an expression like python:hasattr(brain.getObject(), 'getItem') and brain.getObject().getItem('somefield') in ['value1', 'value2'] and brain.getObject().getItem('someotherfield') == 'value3'. This could be turned into a custom catalog index, as well.
  4. It doesn't matter that "indexing in portal_catalog" is turned off. Just create your own custom indexes, and use them as you need in your faceted widgets.
  5. Custom views are easy to create, you can access any items on the document.

The trickiest part for me was figuring out how to create a button to download the search results with the currently selected criteria as an Excel file. But once I got a browser view that does that, I could simply write a classic portlet with a button that calls that view, and use that portlet as a widget.