/** * Indexes a single conversation. * * @param writer the index modifier. * @param conversationID the ID of the conversation to index. * @param external true if the conversation has a participant from an external server. * @param date the date the conversation was started. * @param jids the JIDs of the users in the conversation. * @param text the full text of the conversation. * @throws IOException if an IOException occurs. */ private void indexDocument(IndexModifier writer, long conversationID, boolean external, long date, Set<String> jids, String text) throws IOException { Document document = new Document(); document.add(new Field("conversationID", String.valueOf(conversationID), Field.Store.YES, Field.Index.UN_TOKENIZED)); document.add(new Field("external", String.valueOf(external), Field.Store.YES, Field.Index.UN_TOKENIZED)); document.add(new Field("date", DateTools.timeToString(date, DateTools.Resolution.DAY), Field.Store.YES, Field.Index.UN_TOKENIZED)); for (String jid : jids) { document.add(new Field("jid", jid, Field.Store.YES, Field.Index.TOKENIZED)); } document.add(new Field("text", text, Field.Store.NO, Field.Index.TOKENIZED)); writer.addDocument(document); }