I'm new to Lucene and trying to understand the concept of unique document id, something like a primary key in databases like sql or sqlite etc. While searching, I came across this article: https://blog.mikemccandless.com/2014/05/choosing-which actually fast-unique-identifier-uuid.html <https://blog.mikemccandless.com/2014/05/choosing-fast-unique-identifier-uuid.html> which actually is quite old but it's been said elsewhere, it's still applicable on the latest version as internally things are not changed much in Lucene.
What have I done so far? I have created a simple index where few text files are written as documents, when I open this index in Luke (GUI), on the *Document* tab, I see an option along with a spinner control: *Browse document by Doc # | 0| in 100 docs* If you change the value, it shows the document at the bottom of the GUI. The id seems to be a number in which documents are stored. *Question:* How can one access this id? Why do I need a unique id? Let's assume I have created a simple index with three fields: name, age & city. There is another field, the associated long html text, which I am writing in another index. In a GUI environment where users can search by typing the search term in four of the fields. name | | age | | city | | report | | Usually, people are interested in the first three fields. Report field is not used as much but still available if somebody is interested. *Option 1* When the user is searching only using name, age, city, I'll open the first index, do the search, get the documents and their ids, get the report field directly from the second index using the id. This way no searching is required in the second index. *Option 2* I have recently started learning Lucene and right now I haven't touch the joining part but still here is the question If a user has given a search term in all of the four fields then logically you have to search in both the indexes and find the common doc ids in both searched results. *Question* How will this joining happen, to get the correct results from both the indexes? If possible please refer to some online code example links. Prashant