0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-13 21:42:45 +00:00

limit to 2000

This commit is contained in:
Víctor Losada Hernández
2024-01-27 21:46:28 +01:00
parent 625819da91
commit 20f61bff07
2 changed files with 9 additions and 4 deletions

View File

@@ -45,7 +45,7 @@ const ArchivePage = createClass({
.catch((err) => this.setState({ error: err })) .catch((err) => this.setState({ error: err }))
.finally(() => this.setState({ searching: false })); .finally(() => this.setState({ searching: false }));
}, },
updateUrl: function(query) { updateUrl: function() {
const url = new URL(window.location.href); const url = new URL(window.location.href);
const urlParams = new URLSearchParams(url.search); const urlParams = new URLSearchParams(url.search);
// Clear existing parameters // Clear existing parameters
@@ -88,7 +88,12 @@ const ArchivePage = createClass({
type='text' type='text'
value={this.state.title} value={this.state.title}
onChange={this.handleChange} onChange={this.handleChange}
onKeyDown={(e) => e.key === 'Enter' && this.lookup()} onKeyDown={(e) => {
if (e.key === 'Enter') {
this.handleChange(e);
this.lookup();
}
}}
placeholder='v3 Reference Document' placeholder='v3 Reference Document'
/> />
{/* In the future, we should be able to filter the results by adding tags. {/* In the future, we should be able to filter the results by adding tags.
@@ -96,7 +101,7 @@ const ArchivePage = createClass({
<input type="checkbox" id="v3" /><label>v3 only</label> <input type="checkbox" id="v3" /><label>v3 only</label>
*/} */}
<button onClick={this.lookup}> <button onClick={() => { this.handleChange({ target: { value: this.state.title } }); this.lookup(); }}>
<i <i
className={cx('fas', { className={cx('fas', {
'fa-search': !this.state.searching, 'fa-search': !this.state.searching,

View File

@@ -7,7 +7,7 @@ const archive = {
/* Searches for matching title, also attempts to partial match */ /* Searches for matching title, also attempts to partial match */
findBrews: async (req, res, next) => { findBrews: async (req, res, next) => {
try { try {
const limit = 3000; const limit = 2000;
const brews = await HomebrewModel.find({ const brews = await HomebrewModel.find({
title: { $regex: req.params.query, $options: 'i' }, title: { $regex: req.params.query, $options: 'i' },
published: true published: true