mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-23 07:19:50 -04:00
allow quoted searches
This commit is contained in:
parent
f95bf62cdb
commit
528855895d
@ -52,10 +52,6 @@ export class SearchPage extends SubscriberComponent
|
||||
this.appService.getAutoComplete(value.toLowerCase())
|
||||
)
|
||||
);
|
||||
|
||||
this.cards$.subscribe((state) => {
|
||||
console.log('Cards updated...');
|
||||
});
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
|
@ -636,7 +636,11 @@ export class AppService extends createStateService(reducer, initialState) {
|
||||
});
|
||||
return;
|
||||
}
|
||||
const stem = this.wordToStem.get(q);
|
||||
|
||||
const stem =
|
||||
q.startsWith('"') && q.endsWith('"')
|
||||
? q.split('"').join('') // if its quoted, search the exact term.
|
||||
: this.wordToStem.get(q); // otherwise use the stem to get a broader set of results.
|
||||
|
||||
// handle the first case.
|
||||
if (stem <= this.searchIndexArray[0]) {
|
||||
@ -649,8 +653,7 @@ export class AppService extends createStateService(reducer, initialState) {
|
||||
break;
|
||||
}
|
||||
|
||||
// For each query term, figure out which xml file it is in, and get it.
|
||||
// getSearchRefs returns an array of references.
|
||||
// For each query term, figure out which file it is in, and get it.
|
||||
for (let w = 1; w < this.searchIndexArray.length; w++) {
|
||||
// If we are at the end of the array, we want to use a different test.
|
||||
if (
|
||||
@ -1066,6 +1069,8 @@ export class AppService extends createStateService(reducer, initialState) {
|
||||
prefix = keyword.substr(0, idx).trim() + '; ';
|
||||
}
|
||||
|
||||
qry = qry.split('"').join(''); // remove any quotes, just in case
|
||||
|
||||
if (qry.search(/[0-9]/i) === -1) {
|
||||
// its a word
|
||||
for (const item of BibleReference.Books) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user