SearchGrid

Last modified by slauriere on 2024/02/19 00:05

cogPerforms a Solr search and displays results in a grid with facets on top
TypeXAR
CategoryMacro
Developed by

slauriere

Active Installs2
Rating
1 Votes
LicenseGNU Lesser General Public License 2.1

Installable with the Extension Manager

Description

SearchGrid perfoms a Solr search based on an XClass, a set of facets, a Solr filter and a sort parameter. The results are then laid out either as a grid or as a table, as illustrated below. The extension also comprises macro SearchGridTabs which displays SearchGrids in tabs.

Examples

Grid layout

{{searchGrid class="Help.Applications.Movies.Code.MoviesClass" showHidden="false" sort="title:asc" facets="databaseList1,staticList1"/}}

movie-searchgrid-grid-layout.png

The display of the cells within the grid can be customized by creating an UIX for the UIXP org.xwiki.contrib.searchgrid.cell. An example is given in page MovieSearchGridCell for displaying Movies in a custom way, the result can be seen on page MovieSearchGrid.

Table layout

{{searchGrid id="movies" class="Help.Applications.Movies.Code.MoviesClass" showHidden="false"
    facets="databaseList1,staticList1"
    columns="title,longText1,databaseList1,staticList1,date" limit="30"/}}

movie-searchgrid-table-layout.png

Macro parameters

NameDescriptionMandatoryDefault value
className of the XClass whose instances are to be searched forno
facetsList of facets to be displayed on top of the gridno
filterFilter used when performing the initial search. Example: f_property.Help.Applications.Movies.Code.MoviesClass.staticList1_string=dramano
sortField to be used for ordering the resultsnotitle:asc
showHiddenWhether the hidden pages should be included in the resultsnofalse

Search Grid Tabs Macro

This macro displays several SearchGrids in tabs (the facets are about to be added).

movie-searchgrid-tabs.png

{{searchGridTabs}}
[
  {
    "label": "Movies",
    "class": "Help.Applications.Movies.Code.MoviesClass",
    "facets": ["databaseList1", "staticList1"]
  },
  {
    "label": "Drama",
    "class": "Help.Applications.Movies.Code.MoviesClass",
    "filter": "f_property.Help.Applications.Movies.Code.MoviesClass.staticList1_string=drama",
    "facets": ["databaseList1", "staticList1"]
  }
]
{{/searchGridTabs}}

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.

You can also use the following manual method, which is useful if this extension cannot be installed with the Extension Manager or if you're using an old version of XWiki that doesn't have the Extension Manager:

  1. Log in the wiki with a user having Administration rights
  2. Go to the Administration page and select the Import category
  3. Follow the on-screen instructions to upload the downloaded XAR
  4. Click on the uploaded XAR and follow the instructions
  5. You'll also need to install all dependent Extensions that are not already installed in your wiki

Release Notes

v1.1

v1.0

Initial release

Tags:
    

Get Connected