I'm developing a custom serach using examine via razor script.
Some search criteria are selected form a drop down list and are composed by multiple words, for example "top crystal"
When i process all the criteria with a razor script, i iterate all the information and i build a dynamic lucene query that i execute with RowQuery.
This is the code:
var searcher = ExamineManager.Instance.SearchProviderCollection["ProdottiSearcher"]; var searchCriteria = searcher.CreateSearchCriteria(BooleanOperation.And);
var query = searchCriteria.RawQuery(luceneString); var searchResults = searcher.Search(query);
If i initialize searchTipologia with "top crystal" the result contains all the nodes with filedl tipologia that contains the word top and the word crystal, i wolud like to perform a query with the phrase "top crystal", how can i do that?
I use examine like this and that will match a phrase:
var query = searchCriteria.Field("bodyText",searchString).Or().Field("nodeName", searchString).Or().Field("pageTitle",searchString).Compile(); var searchResults = Searcher.Search(query);
Search with examine single phrase
Hi
I'm developing a custom serach using examine via razor script.
Some search criteria are selected form a drop down list and are composed by multiple words, for example "top crystal"
When i process all the criteria with a razor script, i iterate all the information and i build a dynamic lucene query that i execute with RowQuery.
This is the code:
var searcher = ExamineManager.Instance.SearchProviderCollection["ProdottiSearcher"];
var searchCriteria = searcher.CreateSearchCriteria(BooleanOperation.And);
var luceneString = "";
if(!String.IsNullOrEmpty(searchTipologia)) {
luceneString += "tipologia:" + searchTipologia + " ";
}
if(!String.IsNullOrEmpty(searchLavabo))
{
luceneString += "lavabo:" + searchLavabo + " ";
}
var query = searchCriteria.RawQuery(luceneString);
var searchResults = searcher.Search(query);
If i initialize searchTipologia with "top crystal" the result contains all the nodes with filedl tipologia that contains the word top and the word crystal, i wolud like to perform a query with the phrase "top crystal", how can i do that?
Tahks in advice
Alessandro
Hi!
I use examine like this and that will match a phrase:
var query = searchCriteria.Field("bodyText",searchString).Or().Field("nodeName", searchString).Or().Field("pageTitle",searchString).Compile();
var searchResults = Searcher.Search(query);
// Markus
is working on a reply...