1
0
mirror of https://github.com/flarum/core.git synced 2025-08-06 08:27:42 +02:00

Improve search performance (#1339)

* Improve fulltext gambit

* Only search in visible posts

This change relies on the `visibility-scoping` branch to be merged.

* Change posts table to use InnoDB engine

Doing a JOIN between an InnoDB table (discussions) and a MyISAM table
(posts) is very very (very) bad for performance. FULLTEXT indexes are
fully supported in InnoDB now, and it is a superior engine in every
other way, so there is no longer any reason to be using MyISAM.

* Use ::class

* Only search for comment posts

* Add fulltext index to discussions.title

* Fix migration not working if there is a table prefix

* Update frontend appearance

* Apply fixes from StyleCI

[ci skip] [skip ci]

* Show search result excerpts on mobile
This commit is contained in:
Toby Zerner
2018-02-08 06:38:08 +10:30
committed by GitHub
parent 80ec3b5e17
commit 322a84f516
18 changed files with 278 additions and 299 deletions

View File

@@ -50,27 +50,29 @@
overflow: hidden;
text-overflow: ellipsis;
.read & {
.DiscussionList:not(.DiscussionList--searchResults) .read {
color: mix(@heading-color, @body-bg, 55%);
}
.unread & {
.DiscussionList:not(.DiscussionList--searchResults) .unread & {
font-weight: 600;
}
mark {
background: none;
box-shadow: none;
font-weight: bold;
color: @text-color;
}
}
.DiscussionListItem-info {
list-style-type: none;
padding: 0;
margin: 0;
font-size: 12px;
font-size: 11px;
color: @muted-more-color;
> li {
display: inline;
opacity: 0.7;
.transition(opacity 0.2s);
.DiscussionListItem:hover &, .DiscussionListItem.active & {
opacity: 1;
}
}
.username {
font-weight: bold;
@@ -79,6 +81,24 @@
font-size: 11px;
margin-right: -1px;
}
.item-excerpt {
margin-top: 4px;
margin-right: 170px;
white-space: normal;
font-size: 12px;
line-height: 1.5em;
display: block;
.DiscussionPage-list & {
margin-right: 0;
}
mark {
background: none;
box-shadow: none;
font-weight: bold;
color: inherit;
}
}
}
.DiscussionListItem-count {
float: right;
@@ -89,41 +109,6 @@
cursor: pointer;
}
}
.DiscussionListItem-relevantPosts {
padding-bottom: 15px;
@media @phone {
margin-left: -45px;
margin-right: -35px;
}
.PostPreview {
background: @control-bg;
display: block;
padding: 10px 15px;
border-bottom: 2px dotted @body-bg;
color: @muted-color;
transition: border-color 0.2s;
.DiscussionListItem:hover & {
border-color: lighten(@control-bg, 3%);
}
.Avatar, time {
display: none;
}
.PostPreview-content {
padding-left: 0;
}
&:first-child {
border-radius: @border-radius @border-radius 0 0;
}
&:hover {
background: darken(@control-bg, 3%);
text-decoration: none;
}
}
}
@media @phone {
@@ -212,7 +197,7 @@
.DiscussionListItem-controls {
position: absolute;
right: 5px;
top: 15px;
top: 5px;
z-index: 1;
opacity: 0;
transition: opacity 0.2s;
@@ -244,10 +229,10 @@
margin-right: -65px;
}
.DiscussionListItem-title {
font-size: 15px;
font-size: 16px;
}
.DiscussionListItem-count {
margin-top: 21px;
margin-top: 12px;
margin-right: -70px;
width: 55px;
color: @muted-color;