Dear Team,
I am on Lucene 5.4.0. We are trying to build Suggestions based on the already
Indexed Data. (Say I have indexed field "Content") and the indexes are
available on the file server.
Now, in order to use the suggestion feature, I am using AnalyzingInfixSuggester
to first build the suggest indexes. For this, I have specified the field name
as "Content" and provided another directory wherein the suggest indexes will be
generated.
My problem starts from here:
a. The already indexed data contains two fields ("Content" and "Place").
I want to build suggest indexes on both the fields and in the same directory.
b. Having build the suggest indexes, I wish to add more suggest indexes on
3rd field or the existing 3 fields itself (Everytime I try to do this, it
removes the old indexes.
c. No matter what I do, I am not able to understand how can I keep on
updating the suggest indexes with new data for 2 fields described above and
additionally add new field itself to the suggester.
d. While fetching the suggestions, I am anyhow not specifying any field.
Is there a way to prepare suggest indexes field by field. (i.e. for field
"Content", I have separate suggest indexes , for field "Place" I have separate
suggest indexes, but all of them inside the same directory. And a way to
specify to get suggestions from a specific field.)
Code Snippet for Building Suggest Indexes:
java.nio.file.Path path = FileSystems.getDefault().getPath("D:\\",
"indexRawData");
FSDirectory phraseIndexdir = FSDirectory.open(path);
String fieldContent="Content";
Analyzer analyzerNormal = new StandardAnalyzer();
java.nio.file.Path path2 = FileSystems.getDefault().getPath(indexPath,
"Search");
FSDirectory dir2 = FSDirectory.open(path2);
aInfixSuggester=new AnalyzingInfixSuggester(dir2,analyzerNormal);
IndexReader indexReader= DirectoryReader.open(phraseIndexdir);
aInfixSuggester.build(new LuceneDictionary(indexReader, fieldContent));
Closing all open resources
While searching, I specify the Search directory path as mentioned in path2
above, and get the suggestions by firing the lookup.
Would appreciate some guidance in this regard.
Regards,
Ankit
"Confidentiality Warning: This message and any attachments are intended only
for the use of the intended recipient(s).
are confidential and may be privileged. If you are not the intended recipient.
you are hereby notified that any
review. re-transmission. conversion to hard copy. copying. circulation or other
use of this message and any attachments is
strictly prohibited. If you are not the intended recipient. please notify the
sender immediately by return email.
and delete this message and any attachments from your system.
Virus Warning: Although the company has taken reasonable precautions to ensure
no viruses are present in this email.
The company cannot accept responsibility for any loss or damage arising from
the use of this email or attachment."