Skip to content

Commit

Permalink
Merge IO browse and adv. search pages, refs #9141
Browse files Browse the repository at this point in the history
- Include adv. search criteria and filters in a single expandable partial
- Add adv. search partial to IO browse page
- Mix facets and adv. search form and query in IO browse action
- Add browse options with print preview, export CSV and sort
- Add date sort option, ordering asc. over the events startDate
- Allow two kinds of date range query, inclusive or exact
- Hide repository facet and filter is multi-repository setting disabled
- Add changes to CSV export job including facet filtering
- Change routes adding topLod and showAdvanced params when needed
- Fix arElasticSearchPluginQuery, indexType not needed and facets required
- Leave search index action only for XHR requests from IO treeview search
- Improve AdvanceSearch JS prototype
- Add params like facets filters inside adv. search form to not loose them
- Add all selected facets and filters to header options remove filters
- Match facet and adv. filter url params to keep filter and facet in sync
- Improve part-of facet to show descendants and itself
- Include search-box query inside adv. search criteria
- Remove top level description filter from facets
- Don't show facets with only one item unless it's selected
- Small fixes for print preview
- Add delete option to criterions
- Disable/enable repository facet and filter based on top level descriptions
- Update top level autocomplete URL with repos select value and filter query
- Populate LOD filter with LOD facet terms
- Add settings (migrations and fixtures) to toggle some adv. search filters
- Move all page elements form to settings action, clean a lot of repeated code
- Remove sfThemePlugin, it was only used for the page elements form
- Improve unique data and conditions in language facet
- Stop using @ in facets

Squashed commit of the following:

commit 77f728a
Author: José Raddaoui Marín <[email protected]>
Date:   Fri Dec 11 23:55:37 2015 +0100

    Check repo and parent type in IO autocomplete

commit 87a3eb5
Author: José Raddaoui Marín <[email protected]>
Date:   Fri Dec 11 23:50:09 2015 +0100

    Change label

commit 8f81238
Author: José Raddaoui Marín <[email protected]>
Date:   Wed Dec 2 15:30:22 2015 +0100

    Don't escape boolean criteria

commit 5b79e75
Author: José Raddaoui Marín <[email protected]>
Date:   Wed Dec 2 15:18:44 2015 +0100

    Fix search box and first criterion relation

commit d6c6478
Author: José Raddaoui Marín <[email protected]>
Date:   Tue Dec 1 13:07:17 2015 +0100

    Fix language facet when no results

commit bd1676f
Author: José Raddaoui Marín <[email protected]>
Date:   Tue Dec 1 12:55:37 2015 +0100

    Fix digital object filter tag

commit 20703f4
Author: José Raddaoui Marín <[email protected]>
Date:   Tue Dec 1 12:49:35 2015 +0100

    Fix boolean fields order

commit e9c0d3e
Author: José Raddaoui Marín <[email protected]>
Date:   Fri Nov 20 13:55:03 2015 +0100

    Improve facets code

    - Stop using @ and check existence
    - Fix unique languages data and improve conditions

commit 0ebff71
Author: José Raddaoui Marín <[email protected]>
Date:   Fri Nov 20 12:52:38 2015 +0100

    Cosmetic change

commit 0b22ec2
Author: José Raddaoui Marín <[email protected]>
Date:   Wed Nov 18 20:29:56 2015 +0100

    Remove sfThemePlugin

    After 2.x it was only used in the page elements form
    and after moving the entire form to the settings action
    it's not needed anymore

commit 9205c49
Author: José Raddaoui Marín <[email protected]>
Date:   Wed Nov 18 20:28:16 2015 +0100

    Move all page elements form to settings action

    And clean a lot of repeated code

commit 6ce4b68
Author: José Raddaoui Marín <[email protected]>
Date:   Wed Nov 18 18:26:32 2015 +0100

    Allow to remove copyright and material filters

    - Add settings in migrations and fixtures
    - Include settings in default page elements form
    - Change filters disposition to allow one or two filters in a row
    - Add responsive design for the adv. search partial

commit 2f52376
Author: José Raddaoui Marín <[email protected]>
Date:   Wed Nov 18 13:31:38 2015 +0100

    Fix top-level autocomplete width

commit ac664e7
Author: José Raddaoui Marín <[email protected]>
Date:   Wed Nov 18 13:21:05 2015 +0100

    Populate LOD filter with LOD facet terms

commit 6cb8857
Author: José Raddaoui Marín <[email protected]>
Date:   Tue Nov 17 20:54:27 2015 +0100

    Update top level autocomplete URL with repo value

    Obtained from the repos select and used to filter the autocomplete query

commit aa4bf3a
Author: José Raddaoui Marín <[email protected]>
Date:   Tue Nov 17 19:18:08 2015 +0100

    Disable/enable repository facet and filter

    - Based on if the top level descriptions autocomplete is populated
    - Trigger change events when the autocomplete hidden input is updated

commit e16730e
Author: José Raddaoui Marín <[email protected]>
Date:   Tue Nov 17 17:31:58 2015 +0100

    Fix collection header filter

commit f697fd3
Author: José Raddaoui Marín <[email protected]>
Date:   Tue Nov 17 17:18:37 2015 +0100

    Add delete option to criterions

commit 4a947c9
Author: José Raddaoui Marín <[email protected]>
Date:   Sun Nov 15 23:09:10 2015 +0100

    Merge IO browse and adv. search pages, refs #9141

    - Include adv. search criteria and filters in a single expandable partial
    - Add adv. search partial to IO browse page
    - Mix facets and adv. search form and query in IO browse action
    - Add browse options with print preview, export CSV and sort
    - Add date sort option, ordering asc. over the events startDate
    - Allow two kinds of date range query, inclusive or exact
    - Hide repository facet and filter is multi-repository setting disabled
    - Add changes to CSV export job including facet filtering
    - Change routes adding topLod and showAdvanced params when needed
    - Fix arElasticSearchPluginQuery, indexType not needed and facets required
    - Leave search index action only for XHR requests from IO treeview search
    - Improve AdvanceSearch JS prototype
    - Add params like facets filters inside adv. search form to not loose them
    - Add all selected facets and filters to header options remove filters
    - Match facet and adv. filter url params to keep filter and facet in sync
    - Improve part-of facet to show descentands and itself
    - Include search-box query inside adv. search criteria
    - Remove top level description filter from facets
    - Don't show facets with only one item unless it's selected
    - Small fixes for print preview
  • Loading branch information
jraddaoui committed Dec 11, 2015
1 parent ce85502 commit d9f449c
Show file tree
Hide file tree
Showing 74 changed files with 1,806 additions and 2,714 deletions.
64 changes: 24 additions & 40 deletions apps/qubit/modules/default/actions/browseAction.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,26 @@ protected function populateFacets($resultSet)

$resultSetWithoutLanguageFilter = QubitSearch::getInstance()->index->getType($this::INDEX_TYPE)->search($this->search->query);

$facets[$name]['terms']['unique'] = array(
'count' => $resultSetWithoutLanguageFilter->getTotalHits(),
'term' => 'Unique records');
$count= $resultSetWithoutLanguageFilter->getTotalHits();
}
// Without language filter the count equals the number of hits
else
{
$facets[$name]['terms']['unique'] = array(
'count' => $resultSet->getTotalHits(),
'term' => 'Unique records');
$count= $resultSet->getTotalHits();
}

$i18n = sfContext::getInstance()->i18n;

$uniqueTerm = array(
'unique' => array(
'count' => $count,
'term' => $i18n->__('Unique records')));

// Add unique term at the biginning of the array
// only when there are other terms
if (isset($facets[$name]) && count($facets[$name]['terms']))
{
$facets[$name]['terms'] = $uniqueTerm + $facets[$name]['terms'];
}
}
}
Expand All @@ -114,42 +124,13 @@ protected function populateFacet($name, $ids)
case 'languages':
foreach ($ids as $code => $count)
{
$this->types[$code] = sfCultureInfo::getInstance(sfContext::getInstance()->user->getCulture())->getLanguage($code);
$this->types[$code] = ucfirst(sfCultureInfo::getInstance(sfContext::getInstance()->user->getCulture())->getLanguage($code));
}

break;
}
}

/**
* Determine url parameters based on if the "top-level descriptions" or "all descriptions"
* radio buttons are selected. Also determine which radio button is 'checked'.
*
* Filter out non-top level descriptions from the ES query if the user has selected
* "top-level descriptions."
*/
protected function handleTopLevelDescriptionsOnlyFilter()
{
$this->topLvlDescUrl = $this->context->routing->generate(null, array('topLod' => true) +
$this->request->getParameterHolder()->getAll());

$this->allLvlDescUrl = $this->context->routing->generate(null, array('topLod' => false) +
$this->request->getParameterHolder()->getAll());

if (isset($this->request->topLod) && $this->request->topLod)
{
$this->checkedTopDesc = 'checked';
$this->checkedAllDesc = '';

$this->search->queryBool->addMust(new \Elastica\Query\Term(array('parentId' => QubitInformationObject::ROOT_ID)));
}
else
{
$this->checkedTopDesc = '';
$this->checkedAllDesc = 'checked';
}
}

public function execute($request)
{
// Force subclassing
Expand Down Expand Up @@ -177,16 +158,19 @@ public function execute($request)
$request->sort = $this->sortSetting;
}

$indexType = property_exists($this, 'INDEX_TYPE') ? $this::INDEX_TYPE : null;
$facets = property_exists($this, 'FACETS') ? $this::$FACETS : null;
$facets = property_exists($this, 'FACETS') ? $this::$FACETS : array();

$this->search = new arElasticSearchPluginQuery(
$indexType,
$facets,
$request->limit,
$request->page);

$this->search->addFilters($this->request->getGetParameters());
if (!isset($this->getParameters))
{
$this->getParameters = $request->getGetParameters();
}

$this->search->addFilters($this->getParameters);

if (isset($this->search->filters['languages']))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function execute($request)
$this->query->setQuery($this->queryBool);

// Filter results by parent
if (isset($request->parent))
if (!empty($request->parent) && ctype_digit($request->parent))
{
$queryTerm = new \Elastica\Query\Term;
$queryTerm->setTerm('parentId', $request->parent);
Expand All @@ -79,6 +79,16 @@ public function execute($request)
$this->filterBool->addMust($filter);
}

// Filter results by repository
if (!empty($request->repository) && ctype_digit($request->repository))
{
$queryTerm = new \Elastica\Query\Term;
$queryTerm->setTerm('repository.id', $request->repository);

$filter = new \Elastica\Filter\Query($queryTerm);
$this->filterBool->addMust($filter);
}

// Filter drafts
if (isset($request->filterDrafts) && $request->filterDrafts)
{
Expand Down
Loading

0 comments on commit d9f449c

Please sign in to comment.