Hibernate search - search exact record with multiple query string

We are using hibernate search orm 5.9.2 and would like to achieve the exact search results like:

If user starts with

John -> all data with John should display
John Murphy -> all data with John murphy should display
John murphy Columbia -> Only data with John murphy Columbia should display 
John murphy Columbia SC -> Only data with John murphy Columbia should display  
John murphy Columbia SC 29201 -> Only data with John murphy Columbia SC 29201

29201 -> Only data with 29201 as zipcode should be displayed.
and so on...

Basically we are trying to achieve search on exact records from multiple fields on index.

We have entity containing this data in fields like Name, Address1, address2, city, zipcode, state.

We have tried bool() (with should/must) queries, but as we are not sure what data will user enter first, it could be zipcode, state, city any where in the text search.

Please share your knowledge/logic with regards to analyzers/strategy which we can use to accomplish this with hibernate search/lucene.

It’s a bit hard to understand what your problem is exactly.

Please at least post your entity model and your current query code, and explain what’s wrong with the current behavior, preferably with examples (one set of document, the input from the user, the actual result, the expected result).

That’ll be a start.

Rah, I just saw there was the exact same question on Stackoverflow. I’ll comment the same there. Please stop cross-posting, it just makes things harder for us. Pick the forums or stackoverflow, but not both, especially if you intend to ask lots of questions.

Stackoverflow question: https://stackoverflow.com/questions/52084491/how-to-retrieve-exact-search-results-with-multiple-query-strings-in-hibernate-se

Locking this thread.