Entity Framework에서 키워드 형식으로 검색 기능을 작성하려고합니다.검색 쿼리 문자열을 구문 분석하는 방법 SO
void funcSearch(string keywork)
{
if (keywork == "[tag]")
{
//regex for is tag
//do search tag
}
if (keywork == "user:1234")
{
//regex for userid is 1234
//do search user with 1234
}
...
}
정규식을 사용하여 SO 또는 다른 방법과 같은 쿼리 문자열 형식을 구문 분석 할 수 있습니까? 해당 키워드로 모든 사례를 분석 할 수있는 기능?
tags [tag]
exact "words here"
author user:1234
user:me (yours)
score score:3 (3+)
score:0 (none)
answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
views views:250
sections title:apples
body:"apples oranges"
url url:"*.example.com"
favorites infavorites:mine
infavorites:1234
status closed:yes
duplicate:no
migrated:no
wiki:no
types is:question
is:answer
감사합니다.
수 있습니다. 아니면 그냥 String.Split()을 쓸 수 있습니다. –
원시 검색 데이터가 어떻게 보이는지 알 수 없습니다. 문자 그대로 '? something = value & anotherThing = another Value'와 같은 질의 문자열? – Yuck
왜 반복 할 수 있는지 querystring을 구문 분석합니까? http://msdn.microsoft.com/de-de/library/system.web.httprequest.querystring.aspx – DrCopyPaste