Click here to Skip to main content
15,887,477 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
I am using lucene.net (LUCENE_30) in that I want to search categories which is in GUID format but not able to search that via using lucene searchresult.

Could we search GUID using lucene search?

My code look like this where maxResult = 10000;

C#
QueryParser parser = new QueryParser(version, "IDTag", analyzer);
termQuery = parser.Parse(strIDTag);// where I am passing GUID value
TopDocs topDocs = searcher.Search(termQuery, maxResults);


After this in topDocs I am getting zero hits. What type of search query could I use, I have used QueryParser, BooleanQuery, TermQuery. Could anyone help me on this?
Posted

use this

QueryParser queryParser = new QueryParser(Lucene.Net.Util.Version.LUCENE_30, "SearchText", SearchSettings.Instance.GetAnalyzer());

Query query = null;

query = queryParser.Parse(Text);//search string ex: if u want pass a GUID value : GUID:21312412

Sort sort = new Sort(SortField.FIELD_SCORE);

TopDocs docs = IndexSearch.Search(query, 1000);
 
Share this answer
 
SQL
Check this link in this way I have solved my problem.
http://forums.asp.net/t/1935213.aspx?Search+GUID+using+lucene+net
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900