Hello all,
I have read a couple of tutorials and browsed the Solr documentation. But one thing isn't clear to me. Let me explain:
Let's asume that the following document shall be indexed:
<doc>
<field name="id">R12345</field>
<field name="title">My title</field>
<field name="content">My Content</field>
</doc>
Contrary to this document, the index should contain one extra field called "docType". This extra index field should be filled using a "completion rule". The idea behind this:
If id starts with character "R" then write the String "Resolve" into field docType in the index. If id starts with character "C" then write the String "Contribute" into field docType in the index.
The above document should be available in the index with the following fields:
id=R12345
title=My Title
content=My Content
docType=Resolve
My idea is to use an Analyzer for this. The result of the Analyzer will then be written into field "id" in the index as usual (only a copy of the original text) but the result "Resolve" or "Contribute" should be written in another field.
My basic question is: How can this be achieved in teh Analyzer (Java snipped)? To make it more complex the index field "docType" should be searchable and must be available in the search result. How will the schema look like for field id and docType?
Thanks in advance Tobias