lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 28065] New: - email format field in doc.add(new Field("userID", message.getUserID(), false, true, false)); can not be searched
Date Tue, 30 Mar 2004 20:02:44 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28065>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28065

email format field in doc.add(new Field("userID", message.getUserID(), false, true, false));
can not be searched

           Summary: email format field in doc.add(new Field("userID",
                    message.getUserID(), false, true, false)); can not be
                    searched
           Product: Lucene
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Index
        AssignedTo: lucene-dev@jakarta.apache.org
        ReportedBy: soap@263.net


public static Document messageToDoc(ForumMessage message){
		
		Document doc = new Document();
		ThreadPeer threadPeer = new ThreadPeer();
		ForumThread thread = null;
		try{
			thread = threadPeer.getThread(message.getThreadID());
		}catch(Exception e){
			return null;
		}	
		
		
		doc.add(Field.Keyword("messageID", Long.toString(message.getID())));
		doc.add(new Field("userID", message.getUserID(), false, true, false));
		doc.add(new Field("threadID", Long.toString(message.getThreadID()), false,
true, false));
		doc.add(new Field("forumID", Long.toString(thread.getForumID()), false, true,
false));
		if(message.getSubject() != null){
			doc.add(Field.UnStored("subject", message.getSubject()));
		}	
		if(message.getBody() != null){
			doc.add(Field.UnStored("body", message.getBody()));
		}	
		doc.add(new Field("creationDate",
DateField.dateToString(message.getCreationDate()), false, true, false));
		log.debug("messageToDoc messageID:" + message.getID() + ",userID:" +
message.getUserID() + ",threadID:" + message.getThreadID() + ",forumID:" +
thread.getForumID() + ", subject:" + message.getSubject() + ",body:" +
message.getBody()); 	
		return doc;
	}
public static void addMessagesIndex(ForumMessage[] messages)throws IOException{
		String searchIndexDir = getSearchIndexRoot();
		IndexWriter writer = new IndexWriter(searchIndexDir, getDefaultAnalyzer(), true);
		
		for (int i = 0; i < messages.length; i++){
			Document doc = messageToDoc(messages[i]);
			if (doc != null){
				writer.addDocument(doc, getMessageAnalyzer(messages[i]));
			}	
		}
		writer.optimize();
		writer.close();
	}
when userID is email format like soap@263.net, i can not search  in
userID:soap@263.net

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Mime
View raw message