1

I have developed a search application with Lucene. I have created the basic search. Basically, my app works as follows:

  • My index has many fields. (Around 40)
  • User can enter query to multiple fields i.e: +NAME:John +SURNAME:Doe
  • Queries can contain wildcards such as ? and * i.e: +NAME:J?hn +SURNAME:Do*
  • Queries can also contain fuzzy i.e: +NAME:Jahn~0.5

Now, I want to find, which field(s) contains my search term(s). As I am using wildcard and fuzzy, I cannot just make string comparison. How can I do it?

1 Answer 1

0

If you need it for debugging purposes, you could use IndexSearcher.explain.

Otherwise, this problem looks like highlighting, so you should be able to find out the fields that matched by:

  • re-analyzing your document,
  • or using its term vectors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.