Commit 476711a7 authored by Jörg Richter's avatar Jörg Richter

Utils: add `allowSingleLetterSearch` param to `fulltextQuery()`

See dmx-platform/dmx-platform#287
parent 097b78c4
Pipeline #7968 passed with stage
in 2 seconds
This diff is collapsed.
......@@ -6,7 +6,7 @@ import typeCache from './type-cache'
import permCache from './permission-cache'
import utils from './utils'
console.log('[DMX] Client API 2019/08/15')
console.log('[DMX] Client API 2019/08/22')
export default {
......
......@@ -120,11 +120,11 @@ function containsLuceneSymbol (input) {
* @return a Lucene query.
* If input is a single character returns empty string to signalize the caller no search should be triggered.
*/
function fulltextQuery (input) {
function fulltextQuery (input, allowSingleLetterSearch) {
let query = input.trim()
if (!containsLuceneSymbol(input)) {
query = query.split(/ +/).join(' AND ')
if (query.length === 1) { // don't search single character
if (query.length === 1 && !allowSingleLetterSearch) {
query = ''
} else if (query && !input.endsWith(' ')) {
query += '*'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment