Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/config/database.ini
/logs/sql.log
/logs/application.log
/db/
/files/
/modules/
/themes/
Expand All @@ -17,4 +18,4 @@
.sass-cache
.DS_Store
/application/language/debug.*
/static/
/static/
18 changes: 15 additions & 3 deletions application/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Omeka\Entity\Item;
use Omeka\Entity\Media;
use Omeka\Module\AbstractModule;
use Omeka\Service\ConnectionFactory;
use Laminas\EventManager\Event as ZendEvent;
use Laminas\EventManager\SharedEventManagerInterface;
use Laminas\Form\Element;
Expand Down Expand Up @@ -735,15 +736,26 @@ public function searchFulltext(ZendEvent $event)
}
$qb = $event->getParam('queryBuilder');

$match = 'MATCH(omeka_fulltext_search.title, omeka_fulltext_search.text) AGAINST (:omeka_fulltext_search)';
$conn = $this->getServiceLocator()->get('Omeka\Connection');
$isSqlite = ConnectionFactory::isSqlite($conn);

if ($isSqlite) {
$match = '(omeka_fulltext_search.title LIKE :omeka_fulltext_search OR omeka_fulltext_search.text LIKE :omeka_fulltext_search)';
} else {
$match = 'MATCH(omeka_fulltext_search.title, omeka_fulltext_search.text) AGAINST (:omeka_fulltext_search IN BOOLEAN MODE)';
}

if ('api.search.query' === $event->getName()) {

// Join the fulltext search table and filter items. This must happen
// during "api.search.query" because "api.search.query.finalize"
// happens after we've already gotten the total count.

$qb->setParameter('omeka_fulltext_search', $query['fulltext_search']);
if ($isSqlite) {
$qb->setParameter('omeka_fulltext_search', '%' . $query['fulltext_search'] . '%');
} else {
$qb->setParameter('omeka_fulltext_search', $query['fulltext_search']);
}

$joinConditions = sprintf(
'omeka_fulltext_search.id = omeka_root.id AND omeka_fulltext_search.resource = %s',
Expand All @@ -752,7 +764,7 @@ public function searchFulltext(ZendEvent $event)
$qb->innerJoin('Omeka\Entity\FulltextSearch', 'omeka_fulltext_search', 'WITH', $joinConditions);

// Filter out resources with no similarity.
$qb->andWhere(sprintf('%s > 0', $match));
$qb->andWhere($match);

// Set visibility constraints.
$acl = $this->getServiceLocator()->get('Omeka\Acl');
Expand Down
1 change: 0 additions & 1 deletion application/asset/js/resource-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@
const resourceTemplate = $('#item-stub-resource-template');
const resourceClass = $('#item-stub-resource-class');
const propertyValues = $('#item-stub-property-values');
console.log(itemStubForm.data('resourceTemplateUrl'));
const resourceTemplateUrl = itemStubForm.data('resourceTemplateUrl') + '/' + resourceTemplate.val();
$.get(resourceTemplateUrl, function(rtData) {
const templateResourceClass = rtData['o:resource_class'];
Expand Down
Loading