mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
adding keyword and place to search and instant serach
This commit is contained in:
parent
eb46c53bbb
commit
60dab77cf4
@ -71,10 +71,14 @@ export class MongoSearchManager implements ISearchManager {
|
||||
let result:SearchResult = new SearchResult();
|
||||
result.searchText = text;
|
||||
PhotoModel.find({
|
||||
name: {
|
||||
$regex: text,
|
||||
$options: "i"
|
||||
}
|
||||
$or: [
|
||||
{name: {$regex: text, $options: "i"}},
|
||||
{"metadata.positionData.city": {$regex: text, $options: "i"}},
|
||||
{"metadata.positionData.state": {$regex: text, $options: "i"}},
|
||||
{"metadata.positionData.country": {$regex: text, $options: "i"}},
|
||||
{"metadata.keywords": {$regex: text, $options: "i"}}
|
||||
]
|
||||
|
||||
}).populate('directory', 'name path').exec((err, res:Array<any>) => {
|
||||
if (err || !res) {
|
||||
return cb(err, null);
|
||||
@ -103,10 +107,14 @@ export class MongoSearchManager implements ISearchManager {
|
||||
let result:SearchResult = new SearchResult();
|
||||
result.searchText = text;
|
||||
PhotoModel.find({
|
||||
name: {
|
||||
$regex: text,
|
||||
$options: "i"
|
||||
}
|
||||
$or: [
|
||||
{name: {$regex: text, $options: "i"}},
|
||||
{"metadata.positionData.city": {$regex: text, $options: "i"}},
|
||||
{"metadata.positionData.state": {$regex: text, $options: "i"}},
|
||||
{"metadata.positionData.country": {$regex: text, $options: "i"}},
|
||||
{"metadata.keywords": {$regex: text, $options: "i"}}
|
||||
]
|
||||
|
||||
}).limit(10).populate('directory', 'name path').exec((err, res:Array<any>) => {
|
||||
if (err || !res) {
|
||||
return cb(err, null);
|
||||
|
Loading…
Reference in New Issue
Block a user