Lucene search

Yowaraj Chhetri asked on September 21, 2018 03:06

I want to retrieve results based on a filed condition as follows:


I got a table "xyz" which has a particular column (ShareCOMSPage) which contains multiple choice value such as "IT","CS|ECE","CS|LLB", attached in this photo. I am using Lucene search engine and following query works fine for 1 value "IT"

shareCOMSPage = SearchSyntaxHelper.GetFieldCondition(PageTypes.COMSPage.Fields.ShareCOMSPage, "IT"); query = SearchSyntaxHelper.AddSearchCondition(query, shareCOMSPage);

But what I want is to query on the field "ShareCOMSPage" which contains "IT" or "ECE". I use term contains because 3rd and 4th data from above photo contain "ECE".

Can anyone help me how to achieve this using SearchSyntaxHelper. Thanks in advance

Correct Answer

Yowaraj Chhetri answered on September 21, 2018 07:04

Hi, I solved this using following way.

shareCOMSPage = SearchSyntaxHelper.GetFieldCondition(SearchIndexes.Fields.ShareCOMSPage, $"(IT OR ECE)");

query = SearchSyntaxHelper.AddSearchCondition(query, shareCOMSPage);

0 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.