Rahul Chudasama
Rahul Chudasama

Reputation: 38

search for substring in lucene

i have so many fields to get data from lucene. one of that field is: NTF_com.cisco.vportal.1.TranscodingStatus and its value is: FAILED:DEPLOY_FALSE:bdecc8c3-0389-47b7-bbe5-04a2611e4be9:dms.job.transform.input.format.unsupported.error:dms.job.transform.error.type.permanent

now i want to check to search as weather this value contain FAILED or not.

i tried with the WildcardQuery but its not working for me i put it as

org.apache.lucene.index.Term term=neworg.apache.lucene.index.Term("NTF_com.cisco.vportal.1.TranscodingStatus", "FAILED*");
Query wquery=new WildcardQuery(term);

but not getting proper result.

i just want to check that weather this field contain substring which i passed on it.

Upvotes: 1

Views: 4125

Answers (1)

D_K
D_K

Reputation: 1420

In order to have the content of your field searchable the first step is to make that field analyzed. That means, apply a chain of transformations, clean ups, tokenizations etc to extract searchable units (tokens).

In your case you could use the WordDelimiterFilter as one step in the analysis chain.

Upvotes: 1

Related Questions