Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: solr accents #232

Merged
merged 2 commits into from
Apr 18, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private function legacyConveryBitToJSon($menuitem)
'allowChangeParent' => (bool) (intval($menuitem->attr) & $ATTR_CHANGEPARENT),
'allowDeleteChildren' => ! (intval($menuitem->attr) & $ATTR_NODELETECHILD),
'allowEnabled' => ! (intval($menuitem->attr) & $ATTR_NOENABLE),
'exludeFromSearch' => (bool) $excludeFromSearch,
'excludeFromSearch' => (bool) $excludeFromSearch,
];
$menuitem->properties = ($newProperties);
$menuitem->menu = (bool) (intval($menuitem->attr) & $ATTR_NODELETECHILD);
Expand Down
7 changes: 4 additions & 3 deletions src/Models/Indexes/SolrItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function __construct($solr, $q, $collate = false, private int $highlightL
$this->error = isset($solr->error) ? $solr->error : null;
}

public function isValid()
public function isValid(): bool
{
return $this->header && $this->header->status == 0;
}
Expand Down Expand Up @@ -183,21 +183,22 @@ public function predictions()
return $queries;
}

public function spellcheckList()
public function spellcheckList(): array
{
$items = [];
$query = $this->q;

if (isset($this->spellcheck)) {
foreach ($this->spellcheck->suggestions as $suggestion) {

if (isset($suggestion->startOffset)) {
$suggest = substr($query, 0, $suggestion->startOffset).'<em>'.$suggestion->suggestion[0].'</em>'.substr($query, $suggestion->endOffset);
$suggestTerm = preg_replace('/^([a-zA-Z])+(_[a-zA-Z]{2})?:/', '', $suggest); // remove search field if necessary

$suggest_url = substr($query, 0, $suggestion->startOffset).$suggestion->suggestion[0].substr($query, $suggestion->endOffset);
$suggest_url = preg_replace('/^([a-zA-Z])+(_[a-zA-Z]{2})?:/', '', $suggest_url); // remove search field if necessary

$items[] = (object) ['link' => '?q='.rawurlencode(urldecode($suggest_url)), 'text' => urldecode($suggestTerm)];
$items[] = (object) ['link' => '?q='.rawurlencode(urldecode($suggest_url)), 'text' => $suggestTerm];
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Indexer/IndexBuilderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private function indexChildPages($parentId)

continue;
}
if (isset($page->properties->exludeFromSearch) && $page->properties->exludeFromSearch == true) {
if (isset($page->properties->excludeFromSearch) && $page->properties->excludeFromSearch == true) {
$this->writeDebug(" skipping, page not searchable\n");

continue;
Expand Down
Loading