0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-28 17:52:38 +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 }))
.finally(() => this.setState({ searching: false }));
},
updateUrl: function(query) {
updateUrl: function() {
const url = new URL(window.location.href);
const urlParams = new URLSearchParams(url.search);
// Clear existing parameters
@@ -88,7 +88,12 @@ const ArchivePage = createClass({
type='text'
value={this.state.title}
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'
/>
{/* 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>
*/}
<button onClick={this.lookup}>
<button onClick={() => { this.handleChange({ target: { value: this.state.title } }); this.lookup(); }}>
<i
className={cx('fas', {
'fa-search': !this.state.searching,

View File

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