This commit is contained in:
		
							parent
							
								
									020ce794af
								
							
						
					
					
						commit
						7cf4aa9f11
					
				
					 2 changed files with 21 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -97,14 +97,22 @@ async function byNative(res, rej, me, text, userId, following, mute, reply, repo
 | 
			
		|||
	const push = x => q.$and.push(x);
 | 
			
		||||
 | 
			
		||||
	if (text) {
 | 
			
		||||
		push({
 | 
			
		||||
			$and: text.split(' ').map(x => ({
 | 
			
		||||
				// キーワードが-で始まる場合そのキーワードを除外する
 | 
			
		||||
				text: x[0] == '-' ? {
 | 
			
		||||
					$not: new RegExp(escapeRegexp(x.substr(1)))
 | 
			
		||||
				} : new RegExp(escapeRegexp(x))
 | 
			
		||||
			}))
 | 
			
		||||
		});
 | 
			
		||||
		// 完全一致検索
 | 
			
		||||
		if (/"""(.+?)"""/.test(text)) {
 | 
			
		||||
			const x = text.match(/"""(.+?)"""/)[1];
 | 
			
		||||
			push({
 | 
			
		||||
				text: x
 | 
			
		||||
			});
 | 
			
		||||
		} else {
 | 
			
		||||
			push({
 | 
			
		||||
				$and: text.split(' ').map(x => ({
 | 
			
		||||
					// キーワードが-で始まる場合そのキーワードを除外する
 | 
			
		||||
					text: x[0] == '-' ? {
 | 
			
		||||
						$not: new RegExp(escapeRegexp(x.substr(1)))
 | 
			
		||||
					} : new RegExp(escapeRegexp(x))
 | 
			
		||||
				}))
 | 
			
		||||
			});
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (userId) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,6 +11,11 @@ section
 | 
			
		|||
	p 例えば、「gitというキーワードを含むが、コミットというキーワードは含まない投稿」を検索したい場合、クエリは以下のようになります:
 | 
			
		||||
	code git -コミット
 | 
			
		||||
 | 
			
		||||
section
 | 
			
		||||
	h2 完全一致
 | 
			
		||||
	p テキストを「"""」で囲むと、そのテキストと完全に一致する投稿を検索します。
 | 
			
		||||
	p 例えば、「"""にゃーん"""」と検索すると、「にゃーん」という投稿のみがヒットし、「にゃーん…」という投稿はヒットしません。
 | 
			
		||||
 | 
			
		||||
section
 | 
			
		||||
	h2 オプション
 | 
			
		||||
	p
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue